Solved

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

Posted on 2004-04-27
4
327 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
ID: 10930241
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
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…

679 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