Solved

How to invoke sql script from procedure in PL/SQL?

Posted on 2004-04-27
4
317 Views
Last Modified: 2012-06-27
Hi,

I want to invoke a sql script from the procedure which i am creating from another sql script main.sql.
Typically my code would look like
create procedure x
begin
       some code.........
       run a.sql
       some code....

end;

I tried using
sql_stmt := '@a.sql'
execute immediate sql_stmt;

but it didn't worked.

Thanks in advance,
Smita
0
Comment
Question by:smita_kulkarni
4 Comments
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 250 total points
Comment Utility
Hi look at this..

step.1 : Calling prime_menu.sql from this below.sql file.

ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YY HH24:MI:SS';

@@bye.sql;


Step.2.

clear;
set line 2;
set buffer 1000;
set line 1000;
set trimout off;
clear screen;
set heading off
col aday format a38
col atime format a15
show user
select '  '||to_char(sysdate,'hh12:mm A.M.') atime,
'  '||to_char(sysdate,'Day Month dd,yyyy') aday ,
' Day of Year:'||to_char(sysdate,'DDD') from dual;
prompt
prompt
set trims on;
set heading on;
clear col;

prompt  ========================================================
prompt  =                                                      =
prompt  =          BYE    Thank you for using the System       =
prompt  =                                                      =
PROMPT  ========================================================


Note: use step.1, and 2 in seperate .sql files and try these steps...

best of luck..

R.K

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now