Calling a stored procedure in PL/SQL-Oracle

Source: Internet
Author: User

The stored procedure has been written in oracle10,CodeAs follows:

 
Create or replace procedure proc_insert (sname in varchar2, sage in int, sexetime in varchar2) isbegin insert into t_test (c_id, c_name, c_age, c_intime, c_exetime) values (values, sname, sage, sysdate, to_date (sexetime, 'yyyy-mm-dd'); End proc_insert;

 

To call this stored procedure in PL/SQL, the following code is used:

Begin
Proc_insert ('hello6', 25, '2017-12-24 ');
Commit;
End;

 

In addition, a stored procedure is added, but sexetime is of the date type. Therefore, you must convert the string to the date type before calling. Otherwise, the call will fail.

Stored Procedure:

Create or replace procedure proc_insert2 (sname in varchar2, sage in int, sexetime in date) isbegin insert into t_test (c_id, c_name, c_age, c_intime, c_exetime) values (values, sname, sage, sysdate, sexetime); End proc_insert2;
Call code:

 

Begin
Proc_insert2 ('hellowh', 26, to_date ('2017-10-20 ', 'yyyy-mm-dd '));
Commit;
End;

 

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.