Sqlloader call from pl/sql
Hi guys,
I want to load information from many text files. All of them are stored in many directories. Each directory has one file and there are about 300 directories for each day (see directory structure).
For instance:
c:\Info\2005-11-11 16:06:05\ftp.txt
c:\Info\2005-11-11 18:07:10\ftp.txt
... and 298 more directories with one file each (the name of the file is the same for all).
Is there a way to process all files calling sqlldr from within a pl/sql?
Otherwise, I should implement a routine to read every file, then use utl_file.get_line and parsing every record.
How the loop to read the files can be configured?
As you can see the directory before the file is found is the date in format yyyy-mm-dd hh24.mi.ss, so, I guess, there could be a loop...end loop cycle but I don't know how.
Thanks for your help.
My environment:
windows 2000 server
Oracle 9i EE.
You need a bit of OS jiggery-pokery to do this. Essentially what you need to do is create the external table using a neutral file name. Then use utl_file.frename to rename your first extract file to this neutral name. insert into target table select * from external table. Rename the second extract file to this neutral name. insert into target table select * from external table. rsinse, repeat 298 times.
Cheers, APC
Similar Messages
-
Web service call from pl/sql 10g
I am having problems in calling a web service from pl/sql. This is what I followed
Here is my wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://svc" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://svc" xmlns:intf="http://svc" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://svc" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="name" type="xsd:string"/>
<element name="location" type="xsd:string"/>
<element name="getGreetingReturn" type="xsd:string"/>
</schema>
</wsdl:types>
<wsdl:message name="getGreetingResponse">
<wsdl:part element="impl:getGreetingReturn" name="getGreetingReturn"/>
</wsdl:message>
<wsdl:message name="getGreetingRequest">
<wsdl:part element="impl:name" name="name"/>
<wsdl:part element="impl:location" name="location"/>
</wsdl:message>
<wsdl:portType name="PlsqlS">
<wsdl:operation name="getGreeting" parameterOrder="name location">
<wsdl:input message="impl:getGreetingRequest" name="getGreetingRequest"/>
<wsdl:output message="impl:getGreetingResponse" name="getGreetingResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PlsqlSSoapBinding" type="impl:PlsqlS">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getGreeting">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getGreetingRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getGreetingResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PlsqlSService">
<wsdl:port binding="impl:PlsqlSSoapBinding" name="PlsqlS">
<wsdlsoap:address location="http://myServer:7001/plsqlsvc/services/PlsqlS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Here is my pl/sql
package body pkg_my_webservice as
vg_funciton_fnc VARCHAR2(256) := 'getGreeting';
vg_ws_address VARCHAR2(255) := 'http://myServer:7001/plsqlsvc/services/PlsqlS';
FUNCTION call_myfuntion(
vp_parameter1 VARCHAR2,
vp_parameter2 VARCHAR2)
RETURN VARCHAR2 AS
ol_req soap_api.t_request;
ol_resp soap_api.t_response;
BEGIN
-- we initilize a new request
ol_req := soap_api.new_request(vg_funciton_fnc,
'xmlns="' || vg_ws_address || '"');
-- we started to add parameters
soap_api.add_parameter(ol_req,'name', 'partns:string',
vp_parameter1);
soap_api.add_parameter(ol_req,'location', 'partns:string',
vp_parameter2);
ol_resp := soap_api.invoke(ol_req, vg_ws_address, vg_funciton_fnc);
-- we get back the results
RETURN soap_api.get_return_value(ol_resp, 'getGreetingReturn', -- result tag name
'xmlns:m="' || vg_ws_address || '"');
exception WHEN others then
dbms_output.put_line ( Utl_Http.get_detailed_sqlcode || Utl_Http.Get_Detailed_Sqlerrm);
return 'exception happened';
END call_myfuntion;
end pkg_my_webservice;
Here is the error
SQL> /
PKG_MY_WEBSERVICE.CALL_MYFUNTION('ABC','EFG')
exception happened
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.or
g/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchem
a-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SO
AP-ENV:Body><getGreeting xmlns="http://myServer:7001/p
lsqlsvc/services/PlsqlS" SOAP-ENV:encodingStyle="http://sche
mas.xmlsoap.org/soap/encoding/"><name xsi:type="string">abc<
/name><location xsi:type="string">efg</location></getGreetin
g></SOAP-ENV:Body></SOAP-ENV:Envelope>
-12535ORA-12535: TNS:operation timed out
Any help appreciated
ThanksIt was found out that the server port was not open from the data-tier.
-
How to make OS calls from PL/SQL?
Hi
I am using Oracle 7.3.4. on Solaris platform. I want to call a unix shell script from a Database Procedure. ( Calling an OS command from PL/SQL code) ( Like the HOST() function available in the Client Side Forms Tool). Anybody can help me?Why?
If you want to do this sort of thing, you would have to write a Java stored procedure that called out to the operating system. This has a number of security implications-- the OS calls will run as the Oracle OS user, so you could do fun things like deleting or corrupting data files. Frequently, there are more secure/ less complex approaches.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Java works stand alone does not when called from PL/SQL
I have this piece of code, which works as a standalone program: It takes in the en_var and returns a path.
But it wont work when called from a store procedure the line of code p = rt.exec("echo "+envar); returns a path as a standalone program returns null when called from a Oracle store procedure.
Thanks for any help just going around and round in circles.
import java.util.*;
class translate
public static String translatePath(String envar)
Runtime rt = Runtime.getRuntime();
int bufSize = 4096;
byte buffer[] = new byte[bufSize];
String path = null;
Process p = null;
String os = null;
String name = null;
String home = null;
String dir = null;
SecurityManager sm = null;
int len = 0;
try
System.out.println("Calling echo "+envar);
os = System.getProperty("os.name");
name = System.getProperty("user.name");
home = System.getProperty("user.home");
dir = System.getProperty("user.dir");
sm = System.getSecurityManager();
p = rt.exec("echo "+envar);
BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
while ((len = bis.read(buffer, 0, bufSize)) != -1)
System.out.write(buffer, 0, len);
path = new String(buffer);
//p.waitFor();
bis.close();
return path;
catch(Exception e)
System.out.println("Exception "+e);
return "ProcessProblem";
//path = "/rims/live/log";Still cant get it to work, it doesnt fall over anymore, but when I input $PATH, it will output $PATH instead of the path for $PATH i.e /rims/live: What does your program output please:
Here is my code:
import java.io.*;
import java.util.*;
class translate
public static String translatePath(String envar)
Runtime rt = Runtime.getRuntime();
Process p = null;
String echoOutput = null;
int len = 0;
try
System.out.println("Calling echo "+envar);
p = rt.exec(new String[]{"/bin/echo",envar});
InputStreamReader isr = new InputStreamReader(p.getInputStream());
BufferedReader br = new BufferedReader(isr);
echoOutput = br.readLine();
br.close();
isr.close();
return echoOutput;
catch(Exception e)
System.out.println("Exception "+e);
return "ProcessProblem";
//path = "/rims/live/log";
Thanks for all your help so far.
Tony -
Web Service Call from PL/SQL
Hi Gurus,
I am calling a Web Service(RoadNet Application) from Oracle PL/SQL(11g Database). My code is working for simple xml type to get the response. But when I tried with a complex XML type, I am getting the response, but it does not have the complete output.
Working Sample Code
Here is the code and the calling block which I am using to call. This does not have any input parameters, just one output parameter.
-----------------Start of the procedure----------------------------------------------------------------------
create or replace
PROCEDURE ORACLE_TO_ROADNET_PROC_TEST (p_input IN NUMBER,
l_out_return OUT NUMBER)
AS
l_service UTL_DBWS.service;--TransportationWebService.Service?? what is DB data service?
l_call UTL_DBWS.call;--TransportationWebService.
l_wsdl_url VARCHAR2(32767);
l_namespace VARCHAR2(32767);
l_soap_env VARCHAR2(32767);
l_soap_enc VARCHAR2(32767);
l_instance VARCHAR2(32767);
l_schema VARCHAR2(32767);
l_service_qname UTL_DBWS.qname;
l_port_qname UTL_DBWS.qname;
l_operation_qname UTL_DBWS.qname;
l_xmltype_in SYS.XMLTYPE;
l_xmltype_out SYS.XMLTYPE;
l_xsdoc DBMS_XMLDOM.DOMDocument;
l_dn DBMS_XMLDOM.DOMNode;
l_return NUMBER;
BEGIN
l_wsdl_url := 'http://10.81.8.39:80/TransportationWebService.wsdl';
l_namespace := 'http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService';
l_service_qname := UTL_DBWS.to_qname(l_namespace, 'TransportationWebService');
l_port_qname := UTL_DBWS.to_qname(l_namespace, 'TransportationWebService');
l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'VersionInformation');
l_service := UTL_DBWS.create_service (
wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
service_name => l_service_qname);
dbms_output.put_line('Created the Web Service');
l_call := UTL_DBWS.create_call (
service_handle => l_service,
port_name => l_port_qname,
operation_name => l_operation_qname);
dbms_output.put_line('Created the Web Service Operation');
--UTL_DBWS.set_target_endpoint_address(l_call, 'http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService/');
UTL_DBWS.set_property(l_call, 'USERNAME', 'SAE');
UTL_DBWS.set_property(l_call, 'PASSWORD', 'CxzMte22');
--UTL_DBWS.set_property(l_call, 'DOMAIN', 'rhea');
UTL_DBWS.set_property(l_call, 'OPERATION_STYLE', 'document');
UTL_DBWS.set_property(l_call, 'SOAPACTION_USE', 'true');
UTL_DBWS.set_property(l_call, 'SOAPACTION_URI', 'http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService/');
l_xmltype_in := SYS.XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
<VersionInformation xmlns="' || l_namespace || '">
<parameters>' || p_input || '</parameters>
</VersionInformation>');
dbms_output.put_line('Prepared the XML String to pass');
l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call ,
request => l_xmltype_in);
dbms_output.put_line('Invoked the Web Services');
UTL_DBWS.release_call (call_handle => l_call);
UTL_DBWS.release_service (service_handle => l_service);
dbms_output.put_line('Before Reading the XML output data');
l_return := l_xmltype_out.extract(''//ns1:VersionInformationResponse/ns1:version/text()','xmlns:ns1="http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService">').getNumberVal();
--dbms_output.put_line('After Reading the XML output data'||l_xmltype_out);
--dbms_output.put_line('l_return'||l_return);
-- l_out_return := l_return;
--dbms_output.put_line('l_dn '||l_dn);
END ORACLE_TO_ROADNET_PROC_TEST;
-------------------------------End Of Procedure----------------------------------------------------
---Call to Web Service----------------------------------------
declare
x_return NUMBER;
Begin
Oracle_to_RoadNet_proc_test (p_input => 1,
l_out_return => x_return);
dbms_output.put_line( ' x_return'||x_return);
end;
-----------------------------------------------------------------------------Sample Code Which is not giving output
Here is the other one which is not returing the right output. It got 3 input parameters and multiple output parameters, looks like it is not reading the inputs and not able to get the response.
-----------------------Start of the procedure---------------------------------------------
create or replace
PROCEDURE ORACLE_TO_ROADNET_PROC(p_region_id IN NUMBER,
p_location_type NUMBER,
p_location_id NUMBER,
l_out_return OUT varchar2)
AS
l_service UTL_DBWS.service;
l_call UTL_DBWS.call;
l_wsdl_url VARCHAR2(32767);
l_namespace VARCHAR2(32767);
l_soap_env VARCHAR2(32767);
l_soap_enc VARCHAR2(32767);
l_instance VARCHAR2(32767);
l_schema VARCHAR2(32767);
l_service_qname UTL_DBWS.qname;
l_port_qname UTL_DBWS.qname;
l_operation_qname UTL_DBWS.qname;
l_xmltype_in SYS.XMLTYPE;
l_xmltype_out SYS.XMLTYPE;
l_xsdoc DBMS_XMLDOM.DOMDocument;
l_dn DBMS_XMLDOM.DOMNode;
l_locationinfo varchar2(100);
BEGIN
l_wsdl_url := 'http://10.81.8.39:80/TransportationWebService.wsdl';
l_namespace := 'http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService';
l_service_qname := UTL_DBWS.to_qname(l_namespace, 'TransportationWebService');
l_port_qname := UTL_DBWS.to_qname(l_namespace, 'TransportationWebService');
l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'RetrieveLocationByIdentity');
l_service := UTL_DBWS.create_service (
wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
service_name => l_service_qname);
dbms_output.put_line('Created the Web Service');
l_call := UTL_DBWS.create_call (
service_handle => l_service,
port_name => l_port_qname,
operation_name => l_operation_qname);
dbms_output.put_line('Created the Web Service Operation');
--UTL_DBWS.set_target_endpoint_address(l_call, 'http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService/');
UTL_DBWS.set_property(l_call, 'USERNAME', 'SAE');
UTL_DBWS.set_property(l_call, 'PASSWORD', 'CxzMte22');
--UTL_DBWS.set_property(l_call, 'DOMAIN', 'rhea');
UTL_DBWS.set_property(l_call, 'OPERATION_STYLE', 'document');
UTL_DBWS.set_property(l_call, 'SOAPACTION_USE', 'true');
UTL_DBWS.set_property(l_call, 'SOAPACTION_URI', 'http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService/');
l_xmltype_in := SYS.XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
<RetrieveLocationByIdentity xmlns="' || l_namespace || '">
<identity>
<regionID>' || p_region_id || '</regionID>
<locationType>' || p_location_type || '</locationType>
<locationID>' || p_location_id || '</locationID>
</identity>
</RetrieveLocationByIdentity>');
dbms_output.put_line('Prepared the XML String to pass');
l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call ,
request => l_xmltype_in);
dbms_output.put_line('Invoked the Web Services');
UTL_DBWS.release_call (call_handle => l_call);
UTL_DBWS.release_service (service_handle => l_service);
dbms_output.put_line('Before Reading the XML output data');
insert into utldbws.EBH_XMLDATA
values
(l_xmltype_out, sysdate);
commit;
select extractvalue(l_xmltype_out,'//ns1:RetrieveLocationByIdentityResponse/ns1:location/ns1:description', 'xmlns:ns1="http://www.roadnet.com/RTS/TransportationSuite/TransportationWebService">' )
into l_locationinfo
from dual;
l_out_return := l_locationinfo;
dbms_output.put_line('l_locationinfo '||l_locationinfo);
END ORACLE_TO_ROADNET_PROC;
----------------------End Of the Procedure-------------------------------------------------------
----------------Calling Block------------------------
DECLARE
p_region_id VARCHAR2(50);
p_location_type VARCHAR2(50);
p_location_id VARCHAR2(50);
L_OUT_RETURN VARCHAR2(100);
BEGIN
ORACLE_TO_ROADNET_PROC(
p_region_id => '310',
p_location_type => '200',
p_location_id => '499022',
L_OUT_RETURN => L_OUT_RETURN
DBMS_OUTPUT.PUT_LINE('L_OUT_RETURN = ' || L_OUT_RETURN);
END;
-----------------------------------------------------------------------------------------------Looks like this is not reading the input parameters and not returning the output but execution is successful. Please go throguh this and let me know, if I am missing anything. If you have worked on similar Web Services, please let me know.
Thanks in advance!
Ravi
Edited by: BluShadow on 16-May-2013 15:19
added {noformat}{noformat} tags for readability. Please read the FAQ: {message:id=9360002} and do this yourself in future posts.1006367 wrote:
I am calling a Web Service(RoadNet Application) from Oracle PL/SQL(11g Database). I would not use UTL_DBWS. I had to do another web service interface recently, had a look at UTL_DBWS, and again decided not to use it. Simply put. It lacks.
I use SOAPUI (OpenSource/free version) to interrogate the web service (read wsdl) and format a sample SOAP envelope to use.
I then use UTL_HTTP and code a HTML POST for that web service, using the SOAPUI generated envelope as template. Supporting WSSE is also not a problem (easily done using PL/SQL).
I posted an example of my approach in {message:id=10448611} almost a year ago - and recent experience having looked at both UTL_DBWS and the plan vanilla PL/SQL HTTP approach, I still recommend the latter. -
Refcursor not returning rows when called from non SQL*Plus IDE or other
Hi all,
I have a very weird problem.
We have recently performed a minor upgrade to our oracle database and are now using:
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
5 rows selected.We have a crystal report selecting data from a refcursor returned by a stored procedure.
The stored procedure updates data when called as well as returning the refcursor in question.
Observe the following test scenario executed in SQL*Plus:
SQL> create table testtab (teststr varchar2(100));
Table created.
Elapsed: 00:00:00.00
SQL> insert into testtab values ('X');
1 row created.
Elapsed: 00:00:00.00
SQL> create or replace procedure testtabproc (p_listcur in out sys_refcursor)
2 as
3 begin
4
5 open p_listcur for
6 select *
7 from testtab
8 where teststr = 'X';
9
10
11 update testtab
12 set teststr = 'Y';
13
14 commit;
15
16 end;
17 /
Procedure created.
Elapsed: 00:00:00.00
SQL> declare
2
3 v_list_cur sys_refcursor;
4
5 type t_out_rec is record (teststr varchar2(100) );
6
7
8
9 v_out_rec t_out_rec;
10
11 v_rec_count number := 0;
12 v_count_limit number := 10000;
13
14 begin
15
16 dbms_output.put_line('about to call proc');
17
18 testtabproc(v_list_cur);
19
20 dbms_output.put_line('about to fetch records');
21
22 fetch v_list_cur into v_out_rec;
23 while v_list_cur%found loop
24 v_rec_count := v_rec_count + 1;
25 if v_rec_count <= v_count_limit then
26 dbms_output.put_line(v_out_rec.teststr);
27 end if;
28 fetch v_list_cur into v_out_rec;
29 end loop;
30 dbms_output.put_line('complete. selected '||v_rec_count||' records.');
31
32
33 end;
34 /
about to call proc
about to fetch records
X
complete. selected 1 records.
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> select * from testtab;
TESTSTR
Y
1 row selected.
Elapsed: 00:00:00.00
SQL> as you can see, the cursor returns data and the table is updated.
now, our problem is with crystal and also when I use the same test case via another IDE like TOAD.
No data is returned from the list but the table is still updated.
We suspect that something is happening that is causing the table to be updated before the refcursor is opened, or at least before the predicates are applied.
has anyone else encountered this problem before?Tubby wrote:
WhiteHat wrote:
nope - it works from sqlplus itermitantly (i.e. we always get the debug output but the cursor only sometimes fetches the rows).
it is almost as if the commit is being executed before the cursor is opened.
I still havn't been able to reproduce it except with the actual scenario that I am working with...Is the code you are dealing with exactly the same as the skeleton you've posted in your original post? Do you perhaps have a generic exception catcher in there somewhere (perhaps catching and hiding an ORA-01555) when the cursor is being fetched?
Not that i expect it to make any difference, but i'm curious as to why you've declared your cursor as IN / OUT ?
p_listcur in out sys_refcursor
the code structure in the real example is almost identical to that test case I produced - the exception handler is only catering for no_data_found, all other errors should be raised as normal.
edit: sorry I forgot to add - it's in/out because apparently that's what crystal reports needs in order to use the refcursor..... I'm not a crystal guy so I can't be any more specific than that sorry......
Edited by: WhiteHat on Oct 11, 2010 9:34 AM -
Java class files works on middle tier but chokes when called from pl/sql
Hi,
I have 2 class files WorkOrder and xxWorkOrder. xxWorkOrder creates an instance of WorkOrder. Both classes are under the /classes directory. Both compile fine and I have used loadjava to upload/resolve both in the database. I can see them as valid under the user_objects table. I created a function using Pl/sql which calls a method in xxWorkOrder. If I remove the line in xxWorkOrder where it creates an instance of WorkOrder, the pl/sql function works fine via sql plus. If I add the line in, it gives me ORA-29532: Java call terminated by uncaught Java exception: java.lang.ExceptionInInitializerError if i run my test again I get a No classdef found error.
If i run the xxWorkOrder class file directly from the server using java, the code works fine with the instantiation of WorkOrder within it.
I'm not sure which step I am missing ? For some reason when the pl/sql function calls the java method in xxWorkOrder and it sees the line where the instance of WorkOrder is created, it chokes.
Please help!
PreetiExceptionInInitializerError means that whatever is being done at the time it occurs is trying to use some class for the first time so that an attempt to initialize that class is occurring and failing. Such a failure typically means that there is code in a static initializer, such as the foo(); in
static SomeType someVarName = foo();
or just any thing within
static { ... }
in the class being initialized which signals an uncaught exception. It's impossible to say why this would be happening in your particular case without seeing the code. Depending on the release you are using there may be more information (such as a backtrace of the original error) in the .trc file. An example of what I am describing in your case would be if the constructor for WorkOrder invoked a method on some class N, where N hadn't previously been used and where N contained
static Class loser = Class.forName('no/such/Class');
In this (admittedly goofy) case you might expect to see in the .trc file a backtrace for the ExceptionInInitializer error with a sub backtrace identified with "Caused by" that starts with a NoClassDefFound exception or the like. This might work outside the server if "no/such/Class" was present there but had not been loaded into the database. -
Webservice call from PL/SQL
Hi,
I am trying to call a RESTful webservice from a PL/SQL block, I am using a 9i DB.
Th webservice accepts a single form-field argument, which is XML string input, below is the code where I am trying to make a call.
I am getting back a very weird error as if the necessary arguments are not being passed, I am not sure if I am passing the parameter in the correct way.
t_request_body := 'request=<?xml version="1.0"?>
<serviceRequest>
<auth>
<ApplicationID>abc</ApplicationID>
<wsPassword>123456</wsPassword>
</auth>
<Request>
<Processor>BAMS</Processor>
<MerchantNumber>AD8360-05</MerchantNumber>
<NAME>FirstName</NAME>
<Email>[email protected]</Email>
<Address1>1234 SOME Street</Address1>
<Address2></Address2>
<City>SOME City</City>
<State>IN</State>
<Zip>12345</Zip>
<Country>US</Country>
<Phone>123-123-1234</Phone>
<Amount>1.00</Amount>
<OrderNumber>ORDER123</OrderNumber>
</Request>
</serviceRequest>';
url := 'https://RestfulWebserviceCall';
UTL_HTTP.SET_RESPONSE_ERROR_CHECK( TRUE );
UTL_HTTP.SET_DETAILED_EXCP_SUPPORT( TRUE );
UTL_HTTP.SET_COOKIE_SUPPORT( TRUE );
--UTL_HTTP.SET_TRANSFER_TIMEOUT( 30 );
--UTL_HTTP.SET_FOLLOW_REDIRECT( 3 );
UTL_HTTP.SET_PERSISTENT_CONN_SUPPORT( TRUE );
t_http_req:= UTL_HTTP.BEGIN_REQUEST (url=> url, METHOD => 'POST');
UTL_HTTP.SET_HEADER(t_http_req, 'Content-Type', 'text/xml charset=UTF-8');
UTL_HTTP.SET_HEADER(t_http_req, 'Content-Length', LENGTH(t_request_body));
UTL_HTTP.WRITE_TEXT(t_http_req, t_request_body);
t_http_resp:= UTL_HTTP.GET_RESPONSE(t_http_req);
endLoop := FALSE;
LOOP
EXIT WHEN endLoop;
BEGIN
UTL_HTTP.READ_LINE( t_http_resp, buffer, TRUE );
IF (buffer IS NOT NULL) AND LENGTH(buffer)>0 THEN
DBMS_OUTPUT.PUT_LINE('Output '||buffer);
END IF;
EXCEPTION WHEN UTL_HTTP.END_OF_BODY THEN
endLoop := TRUE;
END;
END LOOP;
UTL_HTTP.END_RESPONSE(t_http_resp);
EXCEPTION
WHEN UTL_HTTP.END_OF_BODY THEN
UTL_HTTP.END_RESPONSE (t_http_resp);
END;
Thanks for your help in advance.Here is part of the attached error message I got back.
coldfusion.runtime.UndefinedElementException: Element REQUEST is undefined in ARGUMENTS.
coldfusion.runtime.DotResolver.resolveSplitNameInMap(DotResolver.java:109)
coldfusion.runtime.CfJspPage._resolve(CfJspPage.java:1615)
coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:1794)
coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:1787)
cfUniversalPaymentService2ecfc2130714418$funcAUTHCAPTURE.runFunction(/x01/www/html/webapis_servertest/ecommerce/UniversalPaymentService.cfc:7)
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:517)
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:496)
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:355)
coldfusion.filter.ComponentFilter.invoke(ComponentFilter.java:187)
coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:374)
coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
coldfusion.filter.PathFilter.invoke(PathFilter.java:94)
coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:138)
coldfusion.xml.rpc.CFCServlet.doPost(CFCServlet.java:289)
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
jrun.servlet.FilterChain.service(FilterChain.java:101)
jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
jrunx.scheduler.WorkerThread.run(WorkerThread.java:66) -
How to Analyse SOAP traffic? (Call from PL/SQL)
Hi,
i distributed a Forte Serviceobject as SOAP Service.
I used Microsoft WebService Studio to acces the Forte 4GL Service. This tool generates the SOAP-request and you can invoke the Forte service. The Request and the response will be displayed.
Everything works fine.
Then i tried an oracle example calling the Forte Service via pl/sql http package. I used the same request (taken out of the WebServiceStudio) and i got the answer "request is not wellform".
Anyone tried the same ? Is there a possibilty to debug the incomming SOAP request ?
TIA
Martin FrenzelHi,
i found the problem. Now it works, so we have an easy way to call Forte Service from Oracle PL/SQL.
Martin Frenzel -
System calls from PL/SQL procedure
I have to invoke the SqlLoader from inside the pl/sql procedure.
I tried with HOST & SYSTEM commands but failed because of some error it was showing .
Declare a HOST or SYSTEM
An urgent help is required.
Thanks in advanceSee this:
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:3618360089466 -
Hi there,
I am trying to call dbms_fga dynamically (of sorts) from a package, and I am getting the error as per the title.
I have tried as many ways as i can think of calling this from another package, with similar results each time.
The user/owner of the package has DBA rights, so it doesn't appear to be a permissions issue.
Oracle Version is 11.1.0.6.0 on Suse.
any ideas on this anyone?
Cheers
CODE:
Attempt 1:
PROCEDURE enable_sql_auditing (on_off in boolean default false) is
v_ssql varchar2(900);
cursor c1 is
select table_name
from all_all_tables
where owner=gcv_pkg_owner;
begin
for rec in c1 loop
sys.dbms_fga.add_policy(object_schema =>''|| gcv_pkg_owner ||'',
object_name => ''|| rec.table_name ||'',
policy_name => ''|| rec.table_name || '_AUDIT''',
handler_schema => ''|| gcv_pkg_owner ||'',
handler_module => 'FGA_SQL',
enable => true);
end loop;
end enable_sql_auditing;
Attempt 2:
PROCEDURE enable_sql_auditing (on_off in boolean default false) is
v_ssql varchar2(900);
cursor c1 is
select table_name
from all_all_tables
where owner=gcv_pkg_owner;
begin
for rec in c1 loop
v_ssql := 'begin sys.dbms_fga.add_policy(object_schema =>''' ||gcv_pkg_owner|| ''', object_name => '''||rec.table_name||''', policy_name => '''||rec.table_name||'_AUDIT'', enable => true); end;';
execute immediate (v_ssql);
end loop;
end enable_sql_auditing;Frenchwood wrote:
The user/owner of the package has DBA rights, so it doesn't appear to be a permissions issue.But it is.
DBA is a role.
permissions within PL/SQL have to be directly granted rather than through roles.
i.e. you need to directly grant execute permission on the package to the required user(s). -
Javascript function call from PL/SQL block
Hello,
I am writing this pl/sql block that has checkbox and onselect, it calls javascript function.
I defined javascript function in page header, even though I get error that says function is not defined.
Please help.
Thank you,
H.I got it resolved...!!!
-
Unix SCRIPT CALL FROM PL/SQL
How can I call an unix script from a PL procedure ?
http://www.orafaq.com/scripts/c_src/extproc.txt
-
Linux script call from PL/SQL does not work?
We are trying to run a simple Linux command using this PL/SQL 10.2 procedure:
PROCEDURE run_linux_script_from_oracle IS
BEGIN
dbms_scheduler.create_job
job_name=>'runtop',
job_type=>'executable',
job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check.sh',
enabled=>true,
auto_drop=>true
DBMS_OUTPUT.PUT_LINE('Successful');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error: ' || SQLERRM);
END;The .sh file has this command which works fine when we run in Linux.
spell /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt > /vol0/FileLoadDir/Bank/DATA_FILES/abcd.txtI get a Successful when I run this command in my SQL*Navigator and a PLS-00225: subprogram or cursor 'ABS' reference is out of scope when I run it in the SQL*Nav in another machine???
Any help would be greatly appreciated.Channa wrote:
We are trying to run a simple Linux command using this PL/SQL 10.2 procedure:NO, posted procedure below RUNS nothing,
post code simply CREATE JOB, but does NOT invoke it!
>
PROCEDURE run_linux_script_from_oracle IS
BEGIN
dbms_scheduler.create_job
job_name=>'runtop',
job_type=>'executable',
job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check.sh',
enabled=>true,
auto_drop=>true
DBMS_OUTPUT.PUT_LINE('Successful');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error: ' || SQLERRM);
END;EXCEPTION handler is BUG & should be removed, discarded & 100% eliminated.
>
The .sh file has this command which works fine when we run in Linux.
spell /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt > /vol0/FileLoadDir/Bank/DATA_FILES/abcd.txtI get a Successful when I run this command in my SQL*Navigator and a PLS-00225: subprogram or cursor 'ABS' reference is out of scope when I run it in the SQL*Nav in another machine???What is "ABS" & why/how does it exist in error message? -
Does Oracle817 support Web Service call from PL/SQL Procedure?
Dear Experts,
Please help. Thanks.I am sure about C-based webservice client. But Java-based webservice client cannot run on 817.
Maybe you are looking for
-
Database connection not closing on time out
Hi All, Not sure if this is the right place for this question but.. I've moved my app (built using jdev10.1.2., adf bc's and jsp's) to an app server. For some reason, the database connection is not closing. I have 46 connections to the database and I
-
I want to share calenders with my wife. We both have I Cloud and seperate Apple IDs. I have allowed her access on I Cal with read and write access but she still cannot see the Calender on the I Pad. Please can someone help. Thanks
-
How to record multiple midi channel data to multiple midi tracks in Logic?
Dear All, I have an electric organ from Yamaha, and it has 3 keyboards, upper keyboard, lower keyboard, and pedal keyboard. They are all running in different midi channels: i.e. upper keyboard: midi channel 1 lower keyboard: midi channel 2 pedal keyb
-
How to remove cash check box of T-Code TP04
Hi Experts, Please guide me how to remove the u201Ccashu201D check box of u201Cadvanceu201D for T-Code TP04 in case of Travel Management Module. I have tried with SCHEMA settings but it is not working IMG Settings : Define Schema and Individual Field
-
Helppp