Solved

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

Posted on 2004-04-27
4
321 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

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 …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…

911 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

19 Experts available now in Live!

Get 1:1 Help Now