Oracle storage process, job, view, trigger

Source: Internet
Author: User

Oracle storage process, job, view, trigger
Stored Procedure

Create or replace procedure TestPro (Descerr out varchar2) isbegin select * from test; exception when others then Descerr: = 'interface table data generation failed! '| Sqlerrm; end TestPro;
Job task
Declare Descerr varchar2 (2000); begin -- stored procedure TestPro (Descerr => descerr); commit; end
View
create or replace view TestView as select id,name from test1;
Trigger
Create or replace trigger TestTrigger alter insert or update on test1 -- two tables test1 and test2 for each rowdeclare -- declare the variable lenNum Number (); status varchar2 (50 ); begin select count (1) into lenNum from test2 t where t. id =: new. id; -- judge the status case: new. ORDERSTATE when 'Wait for payment 'then begin statusnum: = 'wait _ BUYER_PAY '; end; when' waiting for shipment 'then begin statusnum: = 'wait _ SELLER_SEND_GOODS'; end case; -- determine the number if (lenNum <1) then insert into test2 (name, stat) -- or use values (: new. name,: new. stat) select name, stat from test1 t where id =: new. id; else -- update statement end if; end TestTrigger;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.