ASAP: How a stored proc calls OS(unix)Commands
urgent!!
My stored procedure requires to call unix commands HOW DO I DO IT?
my rqrmnt is :
stored proc is :-
1.for each file in a directory($ls)
do
2.sql stmnts of insert etc
/OR
use sqlldr for the same.
done.
** how do i do both the operations 1&2 in the same Oracle procedure?
I know HOST can be used in form for OS command but I never thought about doing OS command in the stored procedure.
Hmm...........
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by [email protected] ... ([email protected]):
urgent!!
My stored procedure requires to call unix commands HOW DO I DO IT?
my rqrmnt is :
stored proc is :-
1.for each file in a directory($ls)
do
2.sql stmnts of insert etc
/OR
use sqlldr for the same.
done.
** how do i do both the operations 1&2 in the same Oracle procedure?
<HR></BLOCKQUOTE>
null
Similar Messages
-
Error committing transaction in Stored Proc call - prev solns not working
Hi All,
Our process invokes a DB adapter to fetch the response from the table for our request via Stored Procedure call but facing the below issue. Its a synchronous process. Stored Procedure is present inside the Package and we are calling the Stored procedure using that Package.
What we did is created a DB datasource of XA type and tried to call the Stored Proc but it was giving a problem “ORA-24777: use of non-migratable database link not allowed” and hence according to this thread Using DB links in Stored proc call in DB adapter 11G SOA we have modified the datasource as non-XA type.
While we do that, we could see that Stored Proc is called and the response is present in the reply payload inside the flow trace. But the instance is getting faulted and the error is “Error committing transaction:; nested exception is: javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a participant in two-phase commit. To force this participation, set the GlobalTransactionsProtocol attribute to LoggingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source.”
We have tried the properties of global transaction support as one phase commit, emulate two phase commit and logging last resource but error remains the same.
Database from which we are getting the response is of version "Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production". Will the database link error arises even if we connect to Oracle Database?
Please could you advise me solutions to resolve this issue.
Thanks in advance.You are using Non-XA because it means (among all others) that the commit issue can be handle by the DB as well.
The Emulate Two Phase property imitating the XA transaction in that way, that it allows you to manage a local db transaction.
You can stay with XA connection, but then you will have to use "AUTONOMOUS_TRANSACTION pragma" in your procedure.
Enter the following link to find good explanation about all of your questions:
http://docs.oracle.com/cd/E15523_01/integration.1111/e10231/adptr_db.htm#BGBIHCIJ
Arik -
HI
I have written a c application using OCI which can call stored proc. but that is using blocking call. Is it possible to call stored proc in non blocking mode? So that I can receive output in call back function. Actually stored proc take much time to execute can I associate some Subscription callback-function with my stored proc call. Any idea?
Thanks
KamranIf you want to do non-blocking calls in OCI, you just need to set the server handle (svrhp below) attribute:
sb2 polling=1;
OCIAttrSet((dvoid *)svrhp,
(ub4)OCI_HTYPE_SERVER,
(dvoid *)&polling,
(ub4)0,
(ub4)OCI_ATTR_NONBLOCKING_MODE,
(OCIError *) errhp);
And then you call you OCIExecute() as you would in blocking mode. The difference is that instead of blocking until the call is done on the server, it always returns immediately. So instead of calling it just once per statement and checking the return code, you must keep calling OCIExecute() until it does not equal OCI_STILL_EXECUTING. When the proc is done, the final call to OCIExecute() will then be OCI_SUCCESS, OCI_ERROR, whatever happened. -
Hi Community,
It's possible to create a program that a call does a unix command.
I would like created a synchronous scenario.
Then the program call a unix command and this is waiting up to when a unix command termined a runtime.
The command returned a data and the ABAP program will owe to take back the esecution.
I hope in you
Thank's everybody.Hi Antonello,
i'd do it with different job steps (SM36)
1) Program1, which does a unix command:
syntax:
CALL 'SYSTEM' ID 'COMMAND' FIELD COMMAND
ID 'TAB' FIELD TABL-SYS.´
or have a look here: external commands
2) Program2 handle the output (e.g. a file) of program 1
regards Andreas -
Calling an unix command from a java program which runs on windows
Hello All
I have an Java Application which is run on windows server (I)
I have another Sun Server (II)
I want to call an unix command on server(II) from java application which is on server(I)
I am using Samba Server in order to share files between Windows Server and Unix Server
Can I use samba in order to call command
or is there any way to open an telnet session within java application
I will be grateful if you give me some suggestion on this issue
Regards
BEKIR BALCIK
J2EE Application Developer
Argela Technologies ...cross post
http://forum.java.sun.com/thread.jspa?threadID=624601&messageID=3553626#3553626 -
Calling an Unix command on Remote sun Server in a Java Code
Hello All
I have an Java Application which is run on windows server (I)
I have another Sun Server (II)
I want to call an unix command on server(II) from java application which is on server(I)
I am using Samba Server in order to share files between Windows Server and Unix Server
Can I use samba in order to call command
or is there any way to open an telnet session within java application
I will be grateful if you give me some suggestion on this issue
Regards
BEKIR BALCIK
Argela Technologies ...Can I use samba in order to call commandYes, smaba supports "magic" files that cause a program to be executed when they are accessed. Note, this does not provide for arguments but you can put these in a file which you command reads.
or is there any way to open an telnet session within java applicationYes. just use a Socket connection. -
Calling a Unix Command from Java
Hi all,
I'm not a Java guy, I need a small help, I need a code which will call a Unix Command called from a Java code. For Example I need a Java code whereby I should be able to do a 'ls -lt' on my Unix box. Can anybody please help.
Thanks,
ShantanuSee Runtime.exec()
-
ASAP:stored proc calling Unix commands
i want an Oracle stored procedure to call unix commands as well as do sqlldr ... opern.
requirement is :
the stored procedure needs to do :
for all files in a Directory:
do
{ .. use sqlldr to insert data in tbls
.. move the processed file into another directory
so,for ls &mv commands i need the Command/way out.
nullHi Jorma,
It's been a while since I did it, but I successfully did what you
are trying to do. All I did was "load" the remote interface and
"stub" class into the database using the "loadjava" utility. My
environment was Oracle 8.1.7 on SUN (Sparc) Solaris 7.
Although I haven't tried it, you may be able to invoke a servlet
from your java stored procedure. The advantage over RMI is that
you don't need to generate and load a "stub" class. Naturally, you
would use the "java.net.URLConnection" class to invoke a servlet
on some web-server/servlet engine which you can communicate with
using "streams" -- java.io.InputStream and java.io.OutputStream
Also, I understand that there is now a "oc4jclient.jar" (not 100%
sure of the name) file that can be "loaded" into the database,
which allows you to contact EJB's in Oracle's OC4J product. I
think you can either do this directly, or indirectly using JMS
over Oracle AQ.
[JMS = Java Messaging Service]
[AQ = Advanced Queueing]
Good Luck,
Avi. -
I have a stored proc that is defined as
CREATE or REPLACE
PROCEDURE ABC
(linkid IN CHAR,
Year_in IN DATE,
Method_in IN CHAR,
Date_out OUT DATE,
average_out OUT NUMBER)
is
begin
end;
another partially completed stored proc that returns a ref
cursor defined as follows:
create or replace package zzz
as
type cursorType is ref cursor;
end;
create or replace function test return zzz.cursortype
as
date_OUT date;
Average_OUT number;
l_cursor zzz.cursorType;
CURSOR temp_cur is
SELECT l.linkid, L.routenumber, ABC(l.linkid,
to_date('01/01/2000', 'mm/dd/yyyy'),
'2',
date_OUT,
average_OUT)
FROM LINK l
WHERE l.LINKID <= '010999';
begin
open temp_cur;
end;
inside test (which I need help completing), how can I refer to
the date_out and the average_out params returned by ABC() so
that these values are in turn passed to the cursortype defined
in package zzz?
Thanks in advance.Try rewriting your abc proceudre as two functions, abc1 and
abc2, and rewriting your test function as a test procedure. See
if you can fill in the blanks prefaced by hyphens -- in the
following code:
CREATE OR REPLACE FUNCTION abc1
(linkid IN CHAR,
year_in IN DATE,
method_in IN CHAR)
RETURN DATE
IS
date_out DATE;
BEGIN
SELECT --
INTO date_out
FROM --
WHERE --;
--or
date_out := --;
RETURN date_out;
END abc1;
CREATE OR REPLACE FUNCTION abc2
(linkid IN CHAR,
year_in IN DATE,
method_in IN CHAR)
RETURN NUMBER
IS
average_out NUMBER;
BEGIN
SELECT AVG (--)
INTO average_out
FROM --
WHERE --
GROUP BY --;
--or
average_out := --;
RETURN average_out;
END abc2;
CREATE OR REPLACE PACKAGE zzz
AS
TYPE cursortype IS REF CURSOR;
PROCEDURE test
(temp_cur OUT cursortype);
END zzz;
CREATE OR REPLACE PACKAGE BODY zzz
AS
PROCEDURE test
(temp_cur OUT cursortype)
IS
BEGIN
OPEN temp_cur
FOR
SELECT l.linkid,
l.routenumber,
abc1 (l.linkid,
TO_DATE ('01/01/2000', 'mm/dd/yyyy'),
'2'),
abc2 (l.linkid,
TO_DATE ('01/01/2000', 'mm/dd/yyyy'),
'2')
FROM link l
WHERE l.linkid <= '010999';
END test;
END zzz;
SQL> VARIABLE g_ref REFCURSOR;
SQL> EXEC zzz.test (:g_ref);
SQL> PRINT g_ref -
Can we run a stored proc script from Unix console?
Hello all:
One of my colleagues insists that she used to run a stored proc file, say, abc.proc from a Unix console, with some command. I suspect the "command" is actually a script that invokes sqlplus commands. I never knew a stored proc script can be ran by any built-in Unix command, other than that in sql*plus console.
Anyone can prove me wrong?
Thanks,
JohnnyHi Johnny,
Unix shell doesn't have any means of compiling and/or executing PL/SQL code. You need a client (a driver) to make database calls, like sqlplus. So I think your assumption is correct.
Best regards,
Nikolay -
How to run an applescript using unix command
Hi All,
Can any one help me in giving me the command for running an apple script thru postupgrade shell file in other words i wana run an apple script while running my new installer that will upgrade the old version of application but while installing i want to run an applescript so as i know ill have to give that applescript path in the postupgrade script but how to run it while installation and where to keep it (is it postupgrade). May be in short how can i run apple script thru unix command.Use the osascript command.
In my installer, I use the DropDMG program to build my DMG disk image. It doesn't quit automatically, so I have to do the following:
osascript -e "tell application \"DropDMG\" to quit"
Type "man osascript" for more information. -
How to make system call to execute command line in JAVA?
Hi,
I am new in JAVA. How to make system call to execute the following command line in JAVA in LINUX environment.
rpm -qa jdkIn C programming, use as such:
system ("rpm -qa jdk");
How about JAVA?
Thanks.Runtime.getRuntime().exec. But first read this:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html -
Asynchronous stored proc call in 10g
Hi,
There's an external application that executes one of the stored procedures in my database. I dont want an open connection between the application and database for the duration of procedure execution (execution time can be as long as an hour).
What'd be the best approach to asynchronously call the stored procedure in Oracle 10g?
Also, can I run multiple sessions of the same procedure asynchronously (as the external application is accessible to many users and more than one user can kick-off the process at any point of time).
Any pointers to relevant documentation would be greatly appreciated.
ThanksAnother suggestion can be Streams AQ. I found it very useful.
You can see a working example here:
http://asktom.oracle.com/pls/ask/f?p=4950:8:11739140770566317513::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:8760267539329
All you need to know is here:
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14257/toc.htm -
Stored Proc Execution through OS command using shell script
Hi All,
I have a requirement of executing one stored procedure before putting data in Table through JDBC adaptor and two stored procedures after that.
I was thinking to write a shell script and execute it before and after message processing in adaptor.
Can anybody please tell me how should i write a shell script for it?
I have identified that exec <Stored_Proc_Name> is the syntax for it.
Will i need to write something more in this script?
Thanks,
AtulHi Atul,
Stored procedures are written on the Database server for which you are going to write JDBC adapter.
you will just call the storedprocedure in to your adapter.
as per your requirement you shd run one stored procedure (let us say SP1) and then you have to push data into tables and then run SP2 and SP3...
so for this write three stored procedures and call them into another SP. in this SP you call SP1 first then insert statement to insert data into tables and then SP2 and SP3.
finally call SP into your JDBC adapter.
you can call SP1 in SP as below
Var_SQL :='call SP1 (''' || Var_1 || ''',''' || Var_2 ||''')' ;
EXECUTE IMMEDIATE Var_SQL;
i think for this shell script is not required.. correct me if i am wrong...
Regards,
Sukarna. -
Can we call a Java Stored Proc from a PL/SQL stored Proc?
Hello!
Do you know how to call a Java Stored Proc from a PL/SQL stored Proc? is it possible? Could you give me an exemple?
If yes, in that java stored proc, can we do a call to an EJB running in a remote iAS ?
Thank you!For the java stored proc called from pl/sql, the example above that uses dynamic sql should word :
CREATE OR REPLACE PACKAGE MyPackage AS
TYPE Ref_Cursor_t IS REF CURSOR;
FUNCTION get_good_ids RETURN VARCHAR2 ;
FUNCTION get_plsql_table_A RETURN Ref_Cursor_t;
END MyPackage;
CREATE OR REPLACE PACKAGE BODY MyPackage AS
FUNCTION get_good_ids RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'MyServer.getGoodIds() return java.lang.String';
FUNCTION get_plsql_table_A RETURN Ref_Cursor_t
IS table_cursor Ref_Cursor_t;
good_ids VARCHAR2(100);
BEGIN
good_ids := get_good_ids();
OPEN table_cursor FOR 'SELECT id, name FROM TableA WHERE id IN ( ' | | good_ids | | ')';
RETURN table_cursor;
END;
END MyPackage;
public class MyServer{
public static String getGoodIds() throws SQLException {
return "1, 3, 6 ";
null
Maybe you are looking for
-
When trying to burn a CD, I realised that a LOT of my music (over 700 songs) are not on my laptop. I try and sync my iPod frequently however, a notice pops up saying 'erase and sync' or do nothing. Due to the fact the not all my music is not on my la
-
How to get the Report Names which use a Folder in Discoverer Administrator?
Hello All, How could I get which Reports in discoverer Desktop are using a particular folder in Discoverer Administrator? Or How to know which Discoverer Desktop Reports are being derived from a folder in Discoverer Administrator? We have Oracle 9i D
-
Hi Gurus, Can any one please tell me the complete procedure for configuring output type. Requiremnt is I have to configure a o/p type for Order Confirmation & Invoice. regards, Ajoy
-
Hi, Performance of the below SQL is poor, it takes plenty of time to process this. In what are all the ways, we can optimize this SQL statement. select dt_fld, min(fld2), max(fld2), avg(fld2), min(fld3), max(fld3), avg(fld3) from (select dt_fld1, fld
-
Problem with remote desktop client update