How to execute PL/SQL file (*.sql) ?
In SQL*plus, I use edit command to input a sample PL/SQL program into a foo.sql, but now I don't know how to execute this PL/SQL file in SQL*plus. Who can help me ?
In sql plus, issue the following command (for purposes of this example, I am assuming that foo.sql is in the c:\temp directory.
@c:\temp\foo.sql
The "@" can also be written as
start c:\temp\foo.sql
Similar Messages
-
How to execute a .sql file from a batch file
Hi all
I've to take backup of a database weekly twice on every wednesday & Friday @ 5pm IST. I've written a hot backup script, which works every well.
now i want to automate the script. ie i want this script to run on wednesday & friday @ 5pm without any human interfearance ie with out actually any1 executing this script.
i created a batch file prod.bak with the following lines
@echo off
set oracle_sid=testdb
set oracle_home=d:\oracle\ora92
sqlplus /nolog
connect sys as sysdba/oracletest@testdb
this batch file when eexecuted connects me to sql prompt.
Now i want to execute my backup script bkp.sql automatically when it is connected to sql prompt.
(i tried with these lines in the above batch file...
call bkp.sql---it just opens the bkp.sql file in notepad & displays the script
start bkp.sql---same as call
connect / as sysdba/pwd@[email protected] --- does not work simply remains a the sql prompt.
At 17:00 /Every:w,f "d:\bkp.sql"---does not work simply remains at the sql promt.)
Can any1 let me know what should i write in the batch file that will execute the bkp.sql file automatically after it gets connected to sql prompt. M using oracle 9i.
I'll manage he time through windows utility of scheduling task.. Let me know how to execute the .sql file from a batch file.
Thanks
TriptiTry
sqlplus "sys/oracletest as sysdba" @bpk.sql
Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
Remember to put an exit at the end of the bpk.sql script. -
How to execute a sql file inside a plsql file?
It's easy to exec a plsql inside a sql. Simply
start my_proc.plsql
exec my_proc;
But how to execute a sql file inside a plsql file?
declare ...
begin
start my_sql.sql?
end;
Thanks.
- ZacDoesn't work. Even though @ is different from start in this case but it just doesn't like the way sql and plsql are mixed. For example:
DECLARE n NUMBER := 0;
BEGIN
select COUNT(*) INTO n from user_tab_partitions;
DBMS_OUTPUT.put_line('Number of partitioned tables = ' || to_char(n));
if n = 0 then
DBMS_OUTPUT.put_line('createViewsProcs.sql');
@createViewsProcs.sql
else
DBMS_OUTPUT.put_line('createPartitionViewsProcs.sql');
@createPartitionViewsProcs.sql
end of;
END;
SQL> @postimp.sql
SQL> DECLARE n NUMBER := 0;
2 BEGIN
3 select COUNT(*) INTO n from user_tab_partitions;
4
5 DBMS_OUTPUT.put_line('Number of partitioned tables = ' || to_char(n));
6
7 if n = 0 then
8 DBMS_OUTPUT.put_line('createViewsProcs.sql');
9 @createViewsProcs.sql
9 SET SERVEROUTPUT ON SIZE UNLIMITED;
10 SET TERM ON;
11 SET ECHO ON;
12 EXEC DBMS_OUTPUT.put_line('STARTING VIEWS, PROCS, ETC, THIS MAY TAKE A FEW MINUTES');
13 EXEC DBMS_OUTPUT.put_line(SYSTIMESTAMP());
14
15
16 CREATE OR REPLACE PACKAGE db_convert AS
17 FUNCTION ......
32 END;
33 /
SET SERVEROUTPUT ON SIZE UNLIMITED;
ERROR at line 9:
ORA-06550: line 9, column 5:
PL/SQL: ORA-00922: missing or invalid option
... -
How to execute a sql script in dbms_job?
how to execute a sql script in dbms_job?
See my response to Re: how to execute a sql script file in procedure or trigger.
Cheers, APC -
How to execute an SQL query present in a string inside an ABAP program?
hello,
How to execute an SQL query present in a string inside an ABAP programRaut,
You can execute Native SQl statements.
Ex: To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:
EXEC SQL [PERFORMING <form>].
<Native SQL statement>
ENDEXEC.
There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.
In Native SQL statements, the data is transported between the database table and the ABAP program using host variables. These are declared in the ABAP program, and preceded in the Native SQL statement by a colon (:). You can use elementary structures as host variables. Exceptionally, structures in an INTO clause are treated as though all of their fields were listed individually.
If the selection in a Native SQL SELECT statement is a table, you can pass it to ABAP line by line using the PERFORMING addition. The program calls a subroutine <form> for each line read. You can process the data further within the subroutine.
As in Open SQL, after the ENDEXEC statement, SY-DBCNT contains the number of lines processed. In nearly all cases, SY-SUBRC contains the value 0 after the ENDEXEC statement. Cursor operations form an exception: After FETCH, SY-SUBRC is 4 if no more records could be read. This also applies when you read a result set using EXEC SQL PERFORMING.
EXEC SQL PERFORMING loop_output.
SELECT connid, cityfrom, cityto
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.
Pls. Mark If useful -
How to execute this SQL Query in ABAP Program.
Hi,
I have a string which is the SQL Query.
How to execute this sql Query (SQL_STR) in ABAP Program.
Code:-
DATA: SQL_STR type string.
SQL_STR = 'select * from spfli.'.
Thanks in Advance,
VinayHi Vinay
Here is a sample to dynamically generate a subroutine-pool having your SQL and calling it.
REPORT dynamic_sql_example .
DATA: BEGIN OF gt_itab OCCURS 1 ,
line(80) TYPE c ,
END OF gt_itab .
DATA gt_restab TYPE .... .
DATA gv_name(30) TYPE c .
DATA gv_err(120) TYPE c .
START-OF-SELECTION .
gt_itab-line = 'REPORT generated_sql .' .
APPEND gt_itab .
gt_itab-line = 'FORM exec_sql CHANGING et_table . ' .
APPEND gt_itab .
gt_itab-line = SQL_STR .
APPEND gt_itab .
gt_itab-line = 'ENDFORM.' .
APPEND gt_itab .
GENERATE SUBROUTINE POOL gt_itab NAME gv_name MESSAGE gv_err .
PERFORM exec_sql IN PROGRAM (gv_name) CHANGING gt_restab
IF FOUND .
WRITE:/ gv_err .
LOOP AT gt_result .
WRITE:/ .... .
ENDLOOP .
*--Serdar -
How to execute a SQL procedure in UNIX
How to execute a SQL procedure in UNIX
Check this out..
-Sri
<< a.sql >>
create or replace procedure junk(nout out varchar2) is
x varchar2(20);
begin
select 'Sam' into x
from dual;
nout := x;
end;
<< Shell script >>
sqlplus -s / << DOC
scott/tiger
variable x varchar2(20);
set autoprint on
@a.sql
begin
junk(:x);
end;
exit
DOC
<< Execution of Shell SCript >>
# sh b.sh
Procedure created.
PL/SQL procedure successfully completed.
X
Sam -
How to execute a jar file which has an applet, without using a html file ?
I have a jar file which contains a set of class files. iam able to execute the jar file by using this html code
<html>
<applet code="file.class" archive="file.jar" width="500" height="300">
<param name="name" value="value">
</applet>
</html>
I want to know how to execute this class file without using the html tags.
pls help me out in this.
AnkiHi,
You can make an executable jar file such that when you double click on that it starts running. Just follow the steps.
1. Open a notepad and write the following
Main-Class: XXXXXXXX
XXXXXXX means Your Main Class name. Don't forget to press Enter after you write your class name.
2. Save the file as Mani.mf
3. In the commant prompt ( your directory ) type following lines.
jar cmf Mani.mf Demo.jar *.*
4. This will make a jar file which is executable jar file
Hope this will help you.
Deepak -
Hi All ,
How to execute a .exe file in Jsp without using a process ??? ...
Is it Possiable ????itsdhanasaraa wrote:
But as this a web application ... By using Runtime i'm getting some probs ..
Let me guess, you want your web application to run a program on the client and to your surprise that's not working?
Ain't gonna happen.
its taking more time to execute .... that's y is there any other option to execute .exe file other than Runtime.getRuntime().exec("filename");Write proper English and you may be taken more seriously.
1) it's not "taking more time to execute", whatever that's supposed to mean.
2) there's no other way to execute something. Not that you should every use even that way anyway
3) whenever you start thinking of executing external programs from Java, start thinking of not using Java in the first place. -
How to execute a batch file on different remote server using TFS Build
I have a build server and have 2 web servers. I am deploying using TFS Builds. Now, I have a requirement to execute a batch file which is kept on these 2 web servers. i.e. C:\MyBatch\CreateMe.bat
After my build is successful, I need to execute this batch from the build server.
Note, I cannot make any shared folder.Hi Sameer,
Thanks for your post.
What’s the version of your TFS?
How do you deploy solution using TFS Build, run MSBuild deploy command or using Release Management?
That C:\MyBatch\CreateMe.bat file stay on your two web server machines separately?
If you want execute this bat file on your two web server machines separately using build process template, you need configure your web server machine as build agent, then add the InvokeProcess activity in build process template to run the bat file on build
agent machine after build, please refer to Hari’s answer reply in this post:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/b8bcb19f-1296-441c-8356-e701b949445a/tfs-2010-how-to-execute-a-batch-file-after-build?forum=tfsbuild.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi all,
Please help me out on my XML question as my Cocoon is no longer working.
The question is titled HOW TO EXECUTE/RUN XML FILES IN WLS6.
Thanks in advance.
snodxlook at the samples bea\wlserver6.0sp1\samples\examples\xml
~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
[email protected]
www.filip.net
"snodx" <[email protected]> wrote in message
news:3b4e83dd$[email protected]..
>
Hi all,
Please help me out on my XML question as my Cocoon is no longerworking.
>
The question is titled HOW TO EXECUTE/RUN XML FILES IN WLS6.
Thanks in advance.
snodx -
How to execute SQOOP.cmd file from SSIS execute process task?
How to execute SQOOP.cmd file from SSIS execute process task?
What is argument need to be prefixed in the arguments property
Executable: C:\Hadoop\sqoop-1.4.2\bin\sqoop.cmd
Arguments: /C "sqoop import -connect "jdbc:sqlserver://mysystem:1433;database=test;username=myuser;password=mypwd;" -table emp -target-dir /user/emptable -m 1"
Thanks
DurgaHi Durga,
SQOOP.cmd must be no different than any other .cmd/.bat I assume, your question is more about setting the parameters up I guessed.
So unless the arguments change dynamically you can call SQOOP.cmd from yet another .cmd that has its parameters passed to it and the former you simply set to run without the arguments in Execute Process Task.
Otherwise, in general to set a bat/cmd file to run in SSIS one needs to do this:
PS: It is a good idea to populate the working directory with the path to the .cmd
Arthur My Blog -
How to execute a .cmd file in Solaris server
Hi all , How to execute a .cmd file in Solaris server.
Thanks.Basically you should have the execution flag associated to this cmd file. Check first if this file is builded for Solaris and then you can add the "x" flag to the file permissions.
You can too run it like this, but you should also check if this file is Solaris compatible : # sh <path/cmd file> -
How to execute one .exe file with as3 in air ?
Hi
How to execute one .exe file with as3 in air?
I want do this work without fscommand .
plize help me .itsdhanasaraa wrote:
But as this a web application ... By using Runtime i'm getting some probs ..
Let me guess, you want your web application to run a program on the client and to your surprise that's not working?
Ain't gonna happen.
its taking more time to execute .... that's y is there any other option to execute .exe file other than Runtime.getRuntime().exec("filename");Write proper English and you may be taken more seriously.
1) it's not "taking more time to execute", whatever that's supposed to mean.
2) there's no other way to execute something. Not that you should every use even that way anyway
3) whenever you start thinking of executing external programs from Java, start thinking of not using Java in the first place. -
How to execute a scenario File to File with SAP XI ?
Hi all,
I'm starting study SAP XI, i see in the link follow:
[http://www.****************/Tutorials/XI/File2File/page8.htm]
a scenario to exchange file to file with SAP XI.
After designing and configuration everything (same as tutorial of this scenario), i don't known how to execute this scenario.
Anyone can answer my question: how to execute this scenario file to file?
Please see the link below to understand more about this scenario.
Thanks all a lot in advance,
Point will be reward for any valuable answer.
Vinh VoHi Vinh,
Hope u read all the basic documents of the XI, if not please go through once u wil come to know how to execute a scenario.
the step-by-step procedure for a simple file-file scenario...
First u have to finish the Design Part in the IR
1) Create Data types
2) Create Message Types
3) Create Message Interface
4) Message Mapping
5) Message Interface.
Here it complete the desing part.
Then start thr configuration:-
1) Create the Configuration Scenario
2) Create the Business system and create the Communication Channel.
3) Sender Agreement
4) Receiver Determination
5) Interface Determination
6) Receiver Determination.
If u perfome this steps u wil be successfully complete u r File- File Scenario.
follow the below link to have clear picture of file-file scenario
STEP1:-
/people/srinivas.vanamala2/blog/2007/02/05/step-by-step-guide-xml-file-2-xml-file-scenario-part-i
STEP2:-
/people/srinivas.vanamala2/blog/2007/02/05/step-by-step-guide-xml-file-2-xml-file-scenario-part-ii
Hope this helps u a lot.....
Thankx
Anil
Edited by: Venkat Anil Gannavarapu on Jun 11, 2008 11:36 AM
Edited by: Venkat Anil Gannavarapu on Jun 11, 2008 11:40 AM -
How to execute an external file in java ?
How to execute an external file , where the file name of the external file is in unicode character. (i,e, may be in Chinese character).
Process p = Runtime.getRuntime().exec("/path/to/executable");
This is write. But my question is while the file name is in Chinese font.
It means while a file name is in Chinese font or any unicode character that are supported by window but not in the command prompt. In this case the file name is changed to ??????.doc like.
So, while trying to execute this it shows File not found message.
Maybe you are looking for
-
Animated gif is only output as a grey box
Hi, I'm using CS4 and am trying to make an animated GIF. I've got it all set up and when I play it in Photoshop everything is fine. I then go to File > Save for web and then choose GIF in the dialog box and leave all other boxes alone. In the Optimiz
-
In iTunes I would like to set it to bookmark where I am holding in a song on my iPOD. Let's say I want to play a song that I listen to yesterday and stopped playing it in the middle on my iPOD. Today, I want to listen, on my iPOD, to the same song
-
My name is Sabahattin Bodur. I purchased Macbook Air (MBAIR 13.3/2.0/8/512Flash). The price is $ 2,199.00 (total invoice amount is $ 2,338.64). When I check on your website, the price of this merchandise looks as $ 1,199. I feel that I have paid more
-
How and when does oracle changes the object status on a view?
I have HR schema and AWARD schema. AWARD schema has views referencing the base tables in HR. Whenever I refresh HR the dependant views on AWARD becomes invalid. I recompile those views after the refresh. Could anyone explain the internals of this obj
-
Ridiculous time out durations in sending mail
When sending messages from my MacBook Pro, Often the timeout for failed SMTP sending is ridiculously long... up to three minutes in many instances. There is no cancel button anywhere, and no way I can determine to retrieve the message to try another