Use scripts to call Oracle stored procedures

Source: Internet
Author: User

Prepare an SQL script demo. SQL

Set serveroutput on
Declare
V_name dept. dname % type;
Begin
Select dname into v_name from dept where deptno = & 1;
Dbms_output.put_line ('department name is: '| v_name );
End;
/
Exit;

Then run the following command on the terminal:

Sqlplus "scott/tiger @ orcl" @ demo. SQL 20

Return Value:

SQL * Plus: Release 9.2.0.4.0-Production on Thu Oct 17 21:37:28 2013


Copyright (c) 1982,200 2, Oracle Corporation. All rights reserved.

Connected:
Oracle9i Enterprise Edition Release 9.2.0.4.0-Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0-Production

Old 4: select dname into v_name from dept where deptno = & 1;
New 4: select dname into v_name from dept where deptno = 20;
Department name is: RESEARCH

PL/SQL procedure successfully completed.

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0-Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0-Production

Note: parameters such as & 1, & 2 can be passed to the script.

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.