Calling a stored procedure in PL/SQL--oracle

Source: Internet
Author: User

The stored procedure is written in Oracle10, with the following code:

CREATE OR REPLACE ProcedureProc_insert (SNameinch     varchar2, SAgeinch     int, Sexetimeinch     varchar2) is begin       Insert  intot_test (c_id, C_name, C_age, C_intime, C_exetime)Values(T_test_cid.nextval,sname,sage, Sysdate, To_date (Sexetime,'YYYY-MM-DD'));EndProc_insert;

In order to invoke this stored procedure in PL/SQL, the following code is used:

begin Proc_insert ('hello6',+,'2005-12-24 ') ); Commit ; End;

In addition, a stored procedure is added, but Sexetime is a date type, and when called, the string must first be converted to the date type, otherwise the call will fail.

Stored procedures:

CREATE OR REPLACE ProcedureProc_insert2 (SNameinch     varchar2, SAgeinch     int, Sexetimeinchdate) is begin       Insert  intot_test (c_id, C_name, C_age, C_intime, C_exetime)Values(T_test_cid.nextval,sname,sage, Sysdate, sexetime);EndProc_insert2;

Code to invoke:

begin Proc_insert2 ('hellowhat', to_date ('2010-10-20 ' ' YYYY-MM-DD ' )); Commit ; End;

Go: Call a stored procedure in PL/SQL--oracle

Calling a stored procedure in PL/SQL--oracle

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.