Execetu script file from plsql
Is possible execute statements saved in file from plsql block?
I have file c:\xxx.sql and I want execute it from plsql block. c:\xxx.sql contains DDL and DML statements.
I need something like
begin
execute c:\xxx.sql;
end;
thank you for help
Thank you for reply. Maybe you can help with my problem. I have website and data are in server in mysql database, which I can connect only from localhost. I need get data to oracle database resides on my pc.
I try create this procedure to get data:
utl_http.request('http://........../make_ddl_and_dml_script_for_oracle.php'); --run script, which create script ora.sql on server for oracle
utl_http.request_pieces()--"download" file and save it to my pc
run ora.sql to create or refresh data in my pc
I know that I can solve it using java, but exist any solution???
thank you
Similar Messages
-
How can I rip a 10" x 10" post script file from InDesign 6, it keeps telling me "the active document uses multiple pages sizes and won't print. My page sizes are all 10" x 10"
Please post in the InDesign forums here http://forums.adobe.com/community/indesign/indesign_general. They will be able to help you.
-
Hi,
Is there any shell command or exe to run oracle script file from VB?
thanxYou should be able to call WinExec() (Windows API) there are bound to be MS KB articles that cover this. Create a small CMD file that you pass a parameter to with the SQL Script name and then exec that.
-
How to upload and download any file from plsql through weblogic server
hi all,
how to upload and download any file from plsql through weblogic server? i am using oracle 10g express edition and jboss.
Thanks and Regards,
MSORAhi bala ,
for a windown server u can use VNC (virtual network connection) which opens a session on u r desktop later u can drag and drop form there vice versa and for a linux box you can use Win SCP which helps to open a session with interface to u r desktop in both cases you can upload and down load files very easiy just as we drag and drop items in a simple pc .. we use the same technique...
bye
vamshi -
APEX: How to execute Script file from APEX
Hello All,
Can anyone tell me how to execute script file from APEX?(Step by Step process)
Thanks & Regards,
Jiten Pansarahttp://docs.oracle.com/cd/E23903_01/doc/doc.41/e21677/sql_rep.htm#AEUTL193
Regards, -
Calling a sql script file from a function.
Hi,
I need to call a sql script file from a user defined function. Currently i am trying to do this in Oracle SQL Developer. i tried calling with
@ {filename}, EXECUTE IMMEDIATE etc, but nothing worked. I get the Compiler error.
Basically my need is to call catldap.sql file so that DBMS_LDAP package gets loaded and then I can call the API functions from this.
Please let me know if this is possible doing in a PL/SQL function.
thanks,
Nareshuser784520 wrote:
I need to call a sql script file from a user defined function. Not possible.. and it seems that you do not fully understand the client-server within the Oracle context.
All SQL and PL/SQL are parsed and executed by an Oracle server process. The SQL and PL/SQL engines each expects a single command block at a time. Neither of these can accept a series of separate commands as a single call and then execute each in turn. The SQL engine expects a single SQL statement at a time. The PL engine expects a single PL/SQL anonymous block at a time.
This server process also cannot break into the local file system to access script files. Nor can it hack across the network to access script files on the client.
In order for the server process to access local files, a directory object needs to be created and the current Oracle schema needs read and/or write access on that directory object. As sound security principles apply.
There's no PL/SQL command to execute a script. You must not mistake SQL*Plus commands (this client has a very limited vocabulary) with PL/SQL commands. SQL*Plus executes its own commands.. and send SQL and PL/SQL commands (a statement block a time) to the Oracle server process to be serviced and executed.
It is also a very bad idea to execute external script contents from inside an Oracle server process - as that script resides externally and thus outside Oracle's security mechanisms. This means that is is pretty easy for someone to access that script, compromise it, and then have you inject and execute the contents of that script into the database.
It is not sound security.
Last issue - it is even worse to have application PL/SQL code dynamically creating (or trying to create) portions of the Oracle data dictionary and PL/SQL call interface.
The database needs to be installed correctly - and this includes loading and executing the required rdbms/admin scripts during database installation. It does not make sense at all for application code to try and execute such scripts. It raises numerous issues, including having to allow that application code full and unrestricted SYS access to the database instance. A very serious security violation.
I do not agree at all with the approach you want to use. -
Creating Post Script File from Word Document
Hi How to create a Ps File from Word document.. Is there any api to do this ?
~Arjun(1) It is
PostScript, not
Post Script or
Ps!
(2) To create PostScript from a Microsoft Word document, you simply open such a document in Microsoft Word and print to a PostScript printer driver instance, but chose the
Print to file option. Note that since PostScript from drivers is device-dependent, you do need to choose a PostScript printer driver instance very carefully based on a PPD that has few device dependencies.
- Dov -
Generate xml file from plsql ..
Hi,
I am using oracle 9i.
I have written a script to generate o/p in text file . Its working fine to generate text file.
I wish to create xml file for the same output. How to do this ??
declare
emp_rec emp%ROWTYPE;
file_id UTL_FILE.FILE_TYPE;
BEGIN
file_id := utl_file.FOPEN ('C:\test','test.html','w');
FOR emp IN (SELECT empno,ename FROM emp)
LOOP
utl_file.PUT_LINE( file_id, emp.empno );
utl_file.PUT_LINE( file_id, emp.ename );
END LOOP;
utl_file.fCLOSE(file_id);
END;
--- Desired output ---
<?xml version="1.0" encoding="utf-8" ?>
<Start>
<Row>
<EName>SMITH</EName>
<EMPNO>7369</EMPNO>
</Row>
<Row>
<EName>SMITH</EName>
<EMPNO>7499</EMPNO>
</Row>
<Row>
<EName>ALLEN</EName>
<EMPNO>7521</EMPNO>
</Row>
</Start>
declare
emp_rec emp%ROWTYPE;
file_id UTL_FILE.FILE_TYPE;
BEGIN
file_id := utl_file.FOPEN ('C:\test','test.html','w');
FOR emp IN (SELECT empno,ename FROM emp)
LOOP
utl_file.PUT_LINE( file_id, emp.empno );
utl_file.PUT_LINE( file_id, emp.ename );
END LOOP;
utl_file.fCLOSE(file_id);
END;
Pls guide.Michael,
I've some problem regarding execution of your process -
satyaki>ed
Wrote file afiedt.buf
1 declare
2 ctx integer := dbms_xmlgen.newcontext('select ename "EName", empno from emp');
3 begin
4 dbms_xmlgen.setRowTag(ctx, 'Row');
5 dbms_xmlgen.setRowSetTag(ctx, 'Start');
6 dbms_xslprocessor.clob2file(dbms_xmlgen.getxml(ctx), 'c:\', 'Test.xml');
7* end;
satyaki>/
dbms_xslprocessor.clob2file(dbms_xmlgen.getxml(ctx), 'c:\', 'Test.xml');
ERROR at line 6:
ORA-06550: line 6, column 3:
PLS-00201: identifier 'DBMS_XSLPROCESSOR.CLOB2FILE' must be declared
ORA-06550: line 6, column 3:
PL/SQL: Statement ignored
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
satyaki>Why is it throwing error?
Is this because of lack of privs? Or anything else?
Regards.
Satyaki De. -
Hi,
I have data in csv file. I need to read the data from that file and at the same time i need to omit first row(ie column header). How can i do this...?
Please help me....asap
Thanks in advance....BluShadow wrote:
Nuerni wrote:
Just read-in the csv-file line by line and dismiss the first line; use a tokenizer for each line to get the semicolon-delimited field of every line; now fill your record/table or anything else with the tokens...
There's an tokenizer-example in this forum I've posted recently:
Re: Comma separated values to columns
That's a lot of hard work to achieve something that is built into SQL*Loader and External Tables. All that's needed is the SKIP <n> keyword included in the control definition for those.You're right!
If SQL*Loader and External Tables is an available option for SHAN01 then try use it; if not then I would consider the tokenizer-method... -
Hello,
I am stuck for many days in this issue. Hope someone helps me out.
I am using Oracle 11.
I am writing an utility of Purging the data from the database base on certain criteria.
We don't have physical(actual) partitions present on our system(since we are not using enterprise edition).
We have 57 tables representing 57 partitions. Then we are creating a view of all these 57 tables -
CREATE or REPLACE VIEW MY_VIEW AS
select [column_names] from table1
UNION ALL
select [column_names] from table2
UNION ALL
select [column_names] from table3
UNION ALL
select [column_names] from table57
This upper query is saved in the 'body' of user_views.
Now when a user wants to delete a partition--
-I am reading this query body in .sql file.
-Editing the .sql file ie removing the unwanted 'select * from tablen'
-Dropping the View.
-Recreating the view from the edited .sql file.
The issue is in creating the view on the fly from the procedure--
- I cant do EXECUTE IMMEDIATE 'CREATE VIEW...' and 'DBMS_SQL.PARSE' as the query body is longer than 32767 characters.
So i chose the option to do file write. In the file I write the VIEW query and then I want to create the View from this file.
Now i am not able to call the .sql which contains
CREATE OR REPLACE VIEW MYVIEW AS
select...
UNION ALL
select...
select...
The character length of this file is around 90000.
Please guide me in this issue.
Any new idea to manage the very large View in runtime is also welcome...
Thank You in advance
Vaib
arge View in runtime is also welcome...
Thank You in advance
VaibAs it's 11g, even better would be to use EXECUTE IMMEDIATE as Solomon suggested. It can handle CLOBs.
If it were 10g, then fair enough use the DBMS_SQL package with something like...
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_large_sql CLOB;
3 v_num NUMBER := 0;
4 v_upperbound NUMBER;
5 v_sql DBMS_SQL.VARCHAR2S;
6 v_cur INTEGER;
7 v_ret NUMBER;
8 begin
9 -- Build a very large SQL statement in the CLOB
10 LOOP
11 IF v_num = 0 THEN
12 v_large_sql := 'CREATE VIEW vw_tmp AS SELECT ''The number of this row is : '||to_char(v_num,'fm0999999')||''' as col1 FROM DUAL';
13 ELSE
14 v_large_sql := v_large_sql || ' UNION ALL SELECT ''The number of this row is : '||to_char(v_num,'fm0999999')||''' as col1 FROM DUAL';
15 END IF;
16 v_num := v_num + 1;
17 EXIT WHEN DBMS_LOB.GETLENGTH(v_large_sql) > 40000 OR v_num > 800;
18 END LOOP;
19 DBMS_OUTPUT.PUT_LINE('Length:'||DBMS_LOB.GETLENGTH(v_large_sql));
20 DBMS_OUTPUT.PUT_LINE('Num:'||v_num);
21 --
22 -- Now split that large SQL statement into chunks of 256 characters and put in VARCHAR2S array
23 v_upperbound := CEIL(DBMS_LOB.GETLENGTH(v_large_sql)/256);
24 FOR i IN 1..v_upperbound
25 LOOP
26 v_sql(i) := DBMS_LOB.SUBSTR(v_large_sql
27 ,256 -- amount
28 ,((i-1)*256)+1 -- offset
29 );
30 END LOOP;
31 --
32 -- Now parse and execute the SQL statement
33 v_cur := DBMS_SQL.OPEN_CURSOR;
34 DBMS_SQL.PARSE(v_cur, v_sql, 1, v_upperbound, FALSE, DBMS_SQL.NATIVE);
35 v_ret := DBMS_SQL.EXECUTE(v_cur);
36 DBMS_OUTPUT.PUT_LINE('View Created');
37* end;
SQL> /
Length:40015
Num:548
View Created
PL/SQL procedure successfully completed.
SQL> select count(*) from vw_tmp;
COUNT(*)
548
SQL> select * from vw_tmp where rownum <= 10;
COL1
The number of this row is : 0000000
The number of this row is : 0000001
The number of this row is : 0000002
The number of this row is : 0000003
The number of this row is : 0000004
The number of this row is : 0000005
The number of this row is : 0000006
The number of this row is : 0000007
The number of this row is : 0000008
The number of this row is : 0000009
10 rows selected.
SQL> -
Hi everybody
I must run a script shell after some plsql code
It's possible to execute the script just after in plsql (without java,...)??
thank you for your helpTry using DBMS_SCHEDULER. Your shell script can be a scheduled job that runs right away.
BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'MY SHELL SCRIPT',
job_type => 'EXECUTABLE',
job_action => '/bin/sh',
number_of_arguments => 2 );
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
job_name => 'MY SHELL SCRIPT',
argument_position => 1,
argument_value => '-c' );
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
job_name => 'MY SHELL SCRIPT',
argument_position => 2,
argument_value => '/home/myname/shell.sh' );
DBMS_SCHEDULER.ENABLE('MY SHELL SCRIPT');
END;
Hope this helps.
Anbu Kuppusamy -
Executing .sql scripts file from command prompt
I had created the .sql scripts for
--Create Database
--Create tables
--Create Stored procedure
I am using SQL server 2008.
Now i want to deploy it into the target server using the command prompt.
How can I call to execute that script on the target server?with few errors as "Incorrect Syntax near "GO"".
Hello,
GO is a command, which is only known & interpretted by SSMS + SqlCmd.exe; SQL Server engine / data access components don't know this command, therefore you get an error.
See
Query Options Execution (General Page); for SSMS you can change it from GO to any other term.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
MIME Objects not loaded, Script files from UR not provided to client
We observe diverse JavaScript Errors and missing MIME-Objects on our Clients when trying to start the Application.
We disabled compression for ICF-Service and for the Controllers, disabled HTTP/1.1. - no success.
We followed Hint 715598 and disabled GZIP-Compression for the whole System but the problems occur further.
Has anybody expierienced same behaviours? Is the problem to fix on client side or at WebAs? And of course how to fix ?????
We are on WebAS 6.40 SP 13.
Client-Browser: IE 5.5 SP2 and IE 6.0 SP1
Desparately,
SebastianIt occurs at standard test applications like <i>SBSPEXT_HTMLB</i> and in my custom developed app. So its seeming to be a general problem.
By now we opened an error message @ SAP. -
Hello,
I'm trying to run a simple OpenScript script in Eclipse that creates a record (a Supplier in this case) in Oracle E-Business Suite. So I copied the the script file from OpenScript and created it as a Class in Eclipse. Then I created a main class to call the methods within the script class but no matter what method I call (initialize, run or finalize) I'm getting the java.lang.NullPointerException message. The error doesn't seem to be related with any specific line in the script but with the way that I'm calling it.
Should I call the OpenScript class from my main class in a different way? (see my examples below)
BTW, all external .jar files coming with OATS have been added to my project in Eclipse.
1) Here's the main class I created to call the OpenScript method (Eclipse auto-corrected my main class adding a Try and Catch around the method call):
public class Test {
public static void main(String[] args) {
nvscript nvs = new nvscript();
try {
nvs.initialize();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
2) Here's the script from OpenScript (the actual script has more steps but I'm just using the first one for a proof of concept):
import oracle.oats.scripting.modules.basic.api.*;
import oracle.oats.scripting.modules.browser.api.*;
import oracle.oats.scripting.modules.functionalTest.api.*;
import oracle.oats.scripting.modules.utilities.api.*;
import oracle.oats.scripting.modules.utilities.api.sql.*;
import oracle.oats.scripting.modules.utilities.api.xml.*;
import oracle.oats.scripting.modules.utilities.api.file.*;
import oracle.oats.scripting.modules.webdom.api.*;
import oracle.oats.scripting.modules.formsFT.api.*;
import oracle.oats.scripting.modules.applet.api.*;
public class nvscript extends IteratingVUserScript {
@ScriptService oracle.oats.scripting.modules.utilities.api.UtilitiesService utilities;
@ScriptService oracle.oats.scripting.modules.browser.api.BrowserService browser;
@ScriptService oracle.oats.scripting.modules.functionalTest.api.FunctionalTestService ft;
@ScriptService oracle.oats.scripting.modules.webdom.api.WebDomService web;
@ScriptService oracle.oats.scripting.modules.applet.api.AppletService applet;
@ScriptService oracle.oats.scripting.modules.formsFT.api.FormsService forms;
public void initialize() throws Exception {
this.getSettings().set("formsft.useformsonly",true);
browser.launch();
public void run() throws Exception {
beginStep(
"[1] E-Business Suite Home Page Redirect (/ebs12cloud.winshuttle.com:8000/)",
0);
web.window(2, "/web:window[@index='0' or @title='about:blank']")
.navigate("http://ebs12.xxxxxxx.com:8000/");
web.window(4, "/web:window[@index='0' or @title='Login']")
.waitForPage(null);
think(4.969);
web.textBox(
7,
"/web:window[@index='0' or @title='Login']/web:document[@index='0']/web:form[@id='DefaultFormName' or @name='DefaultFormName' or @index='0']/web:input_text[@id='usernameField' or @name='usernameField' or @index='0']")
.setText("winshuttle_user");
think(2.0);
web.textBox(
8,
"/web:window[@index='0' or @title='Login']/web:document[@index='0']/web:form[@id='DefaultFormName' or @name='DefaultFormName' or @index='0']/web:input_password[@id='passwordField' or @name='passwordField' or @index='0']")
.click();
think(1.109);
web.textBox(
9,
"/web:window[@index='0' or @title='Login']/web:document[@index='0']/web:form[@id='DefaultFormName' or @name='DefaultFormName' or @index='0']/web:input_password[@id='passwordField' or @name='passwordField' or @index='0']")
.setPassword(deobfuscate("kjhkjhkj=="));
think(1.516);
web.button(
10,
"/web:window[@index='0' or @title='Login']/web:document[@index='0']/web:form[@id='DefaultFormName' or @name='DefaultFormName' or @index='0']/web:button[@id='SubmitButton' or @value='Login' or @index='0']")
.click();
endStep();
public void finish() throws Exception {
3) Here's the error messages I'm getting based on the method I call from my main class:
3.a) when calling Initialize():
java.lang.NullPointerException
at oracle.oats.scripting.modules.basic.api.IteratingVUserScript.getSettings(IteratingVUserScript.java:723)
at nvscript.initialize(nvscript.java:22)
at Test.main(Test.java:9)
3 b) when calling Run():
java.lang.NullPointerException
at oracle.oats.scripting.modules.basic.api.IteratingVUserScript.beginStep(IteratingVUserScript.java:260)
at nvscript.run(nvscript.java:30)
at Test.main(Test.java:9)
Any help and/or constructive comment will be appreciated it.
Thanks.
Federico.UPDATE
Compiling from command line I found out that the class definition for oracle.oats.scripting.modules.basic.api.IteratingVUserScript is missing. Do you know what .jar file contains this class?
Thanks.
Fede. -
How can I run a SQL script file...
How can I run a SQL script file from a location on my computer without providing the whole path?
Is there some way I can set a "Working folder" in SQL Plus??
Thanks!
TomYou can create an environment variable called "SQLPATH" which is a list of directories that SQL*Plus will search for your .SQL
scripts.
I would like to use another directory than the oracle/bin...
How can I do this ??
Hello,
U can do this by this way:
Save odm_script.sql file to the default Oracle
directory i.e. Oracle-Home/bin and Run following command
through SQL Plus.
SQL>@Script_Name
I hope this will resolve ur problem.
Regards,
Omer Saeed Khan.
Maybe you are looking for
-
Sometimes when I'm at work or just out and about I will download an album to my iPhone. It used to show up immediately in my iTunes library and I could start listening to my new music right away. It was awesome on trips or in the office or just with
-
Hi all, WIFI of Macbook Air works when the notebook started with OS X. But when I restart the Macbook Air with Win8, the Wifi does not work. The Macbook Air was bought last month. It is new model. The wifi may be a/c. Thanks,
-
Hi, I have an ALV on suppose screen 3000, I have created a button in the tool bar to call another ALV, but my question is, can we display ALV in modal dialog box screen(because the requirement is to display ALV as a popup) So when i changed the scree
-
The Toshiba 32hl86 has an HDMI port. I'm assuming that I can get a miniDVI to DVI converter and a DVI to HDMI converter to plug my Macbook into the TV. Has anyone had success with this? I've read some confusing threads about overscan issues and hands
-
New computer it won't reconize it!
I just got a new computer and i moved all my music files etc over to the itunes program. But now it won't reconize my ipod! Help!!