Calling owb workflow job created in oem using pl/sql
is it possible using pl/sql to call owb workflow job which is created thru oem
can you pl be kind enough to share a sample.
thanks
Hi,
The same question was just answered by another member a couple a days ago want to run owb mappings thru job schedule :
sqlplus_exec_template runtime_owner location_name PROCESS process_name "," ","
sqlplus_exec_template is in "D:\oracle\oraWB\owb\rtp\sql"
Nikolai Rochnik
Similar Messages
-
How to create a counter using Oracle SQL Developer?
Is there any way to create a counter using Oracle SQL Developer to create the below scenario. Meaning it will recorded down the name of user and ID and time and the date they login.
Library portal home statistics shows how many users (outside and within the campus) visit the library portal.
Page Access statistics is recorded on an hourly basis. Users may select the statistics by
yearly (statistics displayed by all months in the selected year)
monthly (statistics displayed by all days in the selected month)
daily (statistics displayed by all hours in the selected day)I'm giving here one basic post - hope this will solve your problem --
SQL>
SQL>
SQL> create table audit_info
2 (
3 usr varchar2(50),
4 log_time timestamp(6)
5 );
Table created.
SQL>
SQL>
SQL> create table err_log
2 (
3 log_cd varchar2(20),
4 log_desc varchar2(500)
5 );
Table created.
SQL>
SQL>
SQL> create or replace procedure ins_err(errcd in varchar2,
2 errnm in varchar2)
3 is
4 pragma autonomous_transaction;
5 begin
6 insert into err_log values(errcd,errnm);
7 commit;
8 end;
9 /
Procedure created.
SQL>
SQL>
SQL> create or replace procedure ins_aud(ud in varchar2,
2 unm in varchar2)
3 is
4 pragma autonomous_transaction;
5 begin
6 insert into audit_info values(ud,unm);
7 commit;
8 exception
9 when others then
10 ins_err(sqlcode,sqlerrm);
11 end;
12 /
Procedure created.
SQL>
SQL>
SQL>
SQL> create or replace trigger log_odsuser1
2 after logon on odsuser1.schema
3 begin
4 ins_aud('ODSUSER1',sysdate);
5 exception
6 when others then
7 ins_err(sqlcode,sqlerrm);
8 end;
9 /
Trigger created.
SQL>
SQL*Plus: Release 9.2.0.1.0 - Production on Tue Jun 12 12:21:09 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
SQL>
SQL>
SQL>
SQL> set serveroutput on
SQL>
SQL>
SQL> select * from audit_info;
USR
LOG_TIME
ODSUSER1
12-JUN-07 12.00.00.00000000 AMHope this will solve your purpose.
Regards.
Satyaki De. -
Creating XML report using PL/SQL Stored Procedure
Hi Friends,
I am working on an xml report with the xml source as PL/SQL Stored Procedure.
I am referring the exercise shown in the following link to understand the process:
http://orclapp.blogspot.com/2012/02/developing-xml-publisher-report-using.html
In the example shown in the above link I could not understand the following:
1) In the following procedure, the out parameter 'retcode' is not used at all.
What is the importance of this parameter.
PROCEDURE REPORT (errbuf OUT VARCHAR2, retcode OUT VARCHAR2, p_product_id IN NUMBER)
2) After the xml data is prepared and put to 'l_result' Clob variable, the following
Loop is executed. I am not able to appreciate why the following loop is required.
LOOP
EXIT WHEN l_length = l_retrieved;
IF (l_length - l_retrieved) < 32000
THEN
SELECT SUBSTR (l_result, l_retrieved + 1) INTO l_xmlstr FROM DUAL;
l_retrieved := l_length;
fnd_file.put_line (fnd_file.output, l_xmlstr);
ELSE
SELECT SUBSTR (l_result, l_retrieved + 1, l_offset)
INTO l_xmlstr
FROM DUAL;
l_retrieved := l_retrieved + l_offset;
fnd_file.put_line (fnd_file.output, l_xmlstr);
END IF;
END LOOP;
3) In the example it is not explained how the concurrent program gets the xml data?
I assume it is written to a file using the following line of code:
fnd_file.put_line (fnd_file.output, l_xmlstr);
I would appreciate if anyone can throw some light into my above queries so that I can understand the process clearly.
Thanks & Regards
HawkerHi 32000 in the code is a 'safe' size smaller than the max available 32767, the loops purpose is to move through the entire thing in chunks that will be manageable in the limits of the data type.
Btw; if you are in Oracle e-business suite then you can also use Oracle reports very simply to create XML output.
If you have reports developer all you need to do is put raw sql (without any 'artifice' to create XML) in the report SQL and then set the reports output to XML in the program definition in Oracle e-business.
best regards,
Robert. -
Can I create a file using pl/sql code in application server ?
Hi
I wanted to create a file(any kind of file .txt .csv .exe etc..) using pl/sql code in application server?
Please help me with an example...in this regard
Regards
Sa864334 wrote:
I wanted to create a file(any kind of file .txt .csv .exe etc..) using pl/sql code in application server?And how is this "file" to be delivered?
Files can be created by PL/SQL code and stored in the Oracle database as CLOBs. This a fairly easy and robust process. It runs entirely in the database. It conforms to transaction processing. The "file" (as a CLOB) resides in the database and can thus be secured via database security, is part of database backups and so on.
The basic issue is how to deliver the contents of the CLOB to the user. If via FTP, then the database can directly FTP the contents of the CLOB to the FTP server as a file. If via HTTP, the database can deliver the CLOB as a HTTP download directly to the web browser.
If the client is Java or .Net, then the CLOB contents can be delivered via SQL or DBMS_LOB or a custom PL/SQL interface.
In such cases, there is no need to step outside the secure and flexible database environment and create a physical o/s file in the wild (outside the controls of database security, data integrity and transaction processing). This is thus recommended and is the preference. -
Creating a XMLfile using pl/sql procedure.
Hi,
I have a scenario here. I have to create a XML file, in a perticular format. Since its not a well formed XML format, I am facing issues while creating the file.
The XML file format is as below.
<SECTION>10-B</SECTION>
<?xml version="1.0" encoding="UTF-8"?>
<Name>
<First>ABC</First>
<Middle>BCD</Middle>
<Lastt>ABC</Last>
<Marks>
<Subj1>89</Subj1>
<Subj2>89</Subj2>
<Subj3>89</Subj3>
</Marks>
</Name>
<?xml version="1.0" encoding="UTF-8"?>
<Name>
<First>ABC</First>
<Middle>BCD</Middle>
<Lastt>ABC</Last>
<Marks>
<Subj1>89</Subj1>
<Subj2>89</Subj2>
<Subj3>89</Subj3>
</Marks>
</Name>
<SECTIONCNT>6</SECTIONCNT>
I tried to create the file using utl functions, But it didnt work. I would like to know is there any alternative approach?
-- AnuOracle 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 Solaris: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
I used the below query to get the XML data from relational tables.
To fetch the header :
SELECT XMLELEMENT (NAME "BATCHHEADER", batch_name) bname
FROM AP_BATCHES_ALL ab
WHERE ab.batch_id = c_batch_id AND ab.org_id = c_org_id;
For the details :
SELECT '<?xml version="1.0" encoding="UTF-8" ?>'
|| XMLELEMENT (
NAME "ABCD",
XMLELEMENT (
NAME "BankSvcRq",
XMLELEMENT (
NAME "RqUID",
'00000000-0000-0000-0000-000000'
|| TO_CHAR (SYSDATE, 'MMDDYY')),
XMLELEMENT (
NAME "XferAddRq",
XMLELEMENT (
NAME "RqUID",
'00000000-0000-0000-0000-000000'
|| TO_CHAR (SYSDATE, 'MMDDYY')),
XMLELEMENT (NAME "PmtRefId", invoice_num),
XMLELEMENT (
NAME "CustId",
XMLFOREST ('B-Bank' AS "SPName",
'B-BankID' AS "CustPermId")),
XMLELEMENT (
NAME "XferInfo",
XMLELEMENT (
NAME "DepAcctIdFrom",
XMLELEMENT (NAME "AcctId", '123456'),
XMLELEMENT (NAME "AcctType", 'DDB'),
XMLELEMENT (NAME "Name", 'Corelogic'),
XMLELEMENT (
NAME "BankInfo",
XMLFOREST ('ABC' AS "BankIdType",
'11111111' AS "BankId"))),
XMLELEMENT (
NAME "DepAcctIdTo",
XMLELEMENT (NAME "AcctId", '888888'),
XMLELEMENT (NAME "AcctType", 'DDD'),
XMLELEMENT (NAME "Name", 'Comerica Bank'),
XMLELEMENT (
NAME "BankInfo",
XMLFOREST ('ABCD' AS "BankIdType",
'11111111' AS "BankId"))),
XMLELEMENT (
NAME "RemoteCheckPayee",
(SELECT XMLELEMENT (NAME "PayeeName",
vendor_name)
FROM po_vendors po
WHERE po.vendor_id = ai.vendor_id)),
XMLELEMENT (
NAME "CurAmt",
XMLFOREST ( invoice_amount AS "Amt",
payment_currency_code AS "CurCode")),
XMLELEMENT (NAME "DueDt",
TO_CHAR (SYSDATE, 'YYYY-MM-DD')),
(SELECT XMLAGG (
XMLELEMENT (
NAME "RefInfo",
XMLFOREST (
'Originator to Beneficiary '
|| distribution_line_number AS "RefType",
ad.description AS "RefId"))
ORDER BY distribution_line_number ASC)
FROM ap_invoice_distributions_all ad
WHERE ad.invoice_id = ai.invoice_id)),
XMLELEMENT (
NAME "PrinterInfo",
XMLELEMENT (
NAME "PrinterId",
'ABCD-Printer')))))
lc_qry
FROM ap_invoices_all ai
WHERE batch_id = 1168207
AND org_id = 13
And for the trailer:
SELECT XMLELEMENT (NAME "BATCHTRAILER", COUNT (1)) cnt
FROM ap_invoices_all ai
WHERE invoice_id = NVL (c_invoice_id, invoice_id)
AND batch_id = c_batch_id
AND org_id = c_org_id
Since the details query is having avery long output, I cant print this in one shot. So I am breaking the line and writing the same in the output file.
But this results in breaking the tags/data,
Regards,
Anupama -
HELP WITH CREATING A VIEW USING PL/SQL
Hello,
I have two tables, one is simply an audit version of the other and anytime data is updated, modified, or deleted the data is copied to the audit table (via a trigger) and the audit table records who made the changes and when.
Here is the description of one of the archive tables:
AUD_OBLIGATION_ID NOT NULL NUMBER(10)
OBLIGATION_ID NUMBER(10)
COMMUNICATION_ID NUMBER(10)
COMMUNICATION_ID_OLD NUMBER(10)
OBL_DESC VARCHAR2(4000)
OBL_DESC_OLD VARCHAR2(4000)
OBL_TYPE VARCHAR2(20)
OBL_TYPE_OLD VARCHAR2(20)
ORIGINAL_TARGET_DATE DATE
ORIGINAL_TARGET_DATE_OLD DATE
TARGET_DATE DATE
TARGET_DATE_OLD DATE
ACTUAL_DATE DATE
ACTUAL_DATE_OLD DATE
STATUS VARCHAR2(20)
STATUS_OLD VARCHAR2(20)
DOCLINK VARCHAR2(200)
DOCLINK_OLD VARCHAR2(200)
SERIAL_NUMBER NUMBER(10)
SERIAL_NUMBER_OLD NUMBER(10)
REMARKS VARCHAR2(200)
REMARKS_OLD VARCHAR2(200)
CREATED_BY VARCHAR2(10)
CREATED_BY_OLD VARCHAR2(10)
CREATION_TS DATE
CREATION_TS_OLD DATE
MODIFIED_BY VARCHAR2(10)
MODIFIED_BY_OLD VARCHAR2(10)
MODIFICATION_TS DATE
MODIFICATION_TS_OLD DATE
UPDATED_BY VARCHAR2(10)
UPDATED_TS DATE
ACTION_TYPE VARCHAR2(10)
I now need to create a view of this audit table, but do not want to list all the columns from the audit table, instead I would like it to look like this:
Modification_TS ** Action_Type ** Updated_By ** CHANGES
Where CHANGES would be a variable that stores the concatenated new & old values (if they are different).
I assume I need to create a stored procedure using PL/SQL to find these values then insert the values into a view...but all of my efforts do not seem to work.
Here is the procedure I've written:
CREATE OR REPLACE PROCEDURE proc_AUD_OBLIGATIONS AS
modData VARCHAR2(2000) :=' ';
emp VARCHAR2(200);
actType VARCHAR2(100);
actDate DATE;
obUser VARCHAR2(500);
CURSOR cur_AUD_OBLIGATION IS
SELECT o.UPDATED_TS, o.UPDATED_BY, o.OBLIGATION_ID, o.COMMUNICATION_ID,o.COMMUNICATION_ID_OLD,o.OBL_DESC,o.OBL_DESC_OLD,
o.OBL_TYPE, o.OBL_TYPE_OLD, o.ORIGINAL_TARGET_DATE,o.ORIGINAL_TARGET_DATE_OLD,o.TARGET_DATE,o.TARGET_DATE_OLD,
o.ACTUAL_DATE,o.ACTUAL_DATE_OLD,o.STATUS,o.STATUS_OLD,o.DOCLINK,o.DOCLINK_OLD,o.SERIAL_NUMBER,o.SERIAL_NUMBER_OLD,
u.FNAME || ' ' ||u.LNAME AS EMPLOYEE,o.ACTION_TYPE
FROM AUD_OBLIGATION o, TRAC_USER u, OBLIGATION_USER ou
WHERE o.OBLIGATION_ID = ou.OBLIGATION_ID
AND
ou.TRAC_USER_ID = u.TRAC_USER_ID;
i_AUD_OBLIGATION cur_AUD_OBLIGATION%rowtype;
BEGIN
for i_AUD_OBLIGATION in cur_AUD_OBLIGATION loop
actType := i_AUD_OBLIGATION.ACTION_TYPE;
actDate := i_AUD_OBLIGATION.UPDATED_TS;
emp := i_AUD_OBLIGATION.UPDATED_BY;
IF i_AUD_OBLIGATION.OBL_DESC != i_AUD_OBLIGATION.OBL_DESC_OLD
THEN modData := 'OBL. DESC. was: ' || i_AUD_OBLIGATION.OBL_DESC_OLD
|| 'It is now: ' ||i_AUD_OBLIGATION.OBL_DESC;
ELSE modData := modData;
END IF;
IF i_AUD_OBLIGATION.OBL_TYPE != i_AUD_OBLIGATION.OBL_TYPE_OLD
THEN modData := modData || 'OBL. TYPE. was: ' ||i_AUD_OBLIGATION.OBL_TYPE_OLD
|| 'It is now: ' ||i_AUD_OBLIGATION.OBL_TYPE;
ELSE modData := modData;
END IF;
IF i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE != i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE_OLD
THEN modData := modData || 'ORIG.TRGT DATE was: ' || i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE_OLD
|| 'It is now: ' ||i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE;
ELSE modData := modData;
END IF;
INSERT INTO vw_AUD_OBLIGATIONS VALUES
(actDate,actType, emp,modData);
END LOOP;
END;
Here is the view I've created, based on this procedure (it does not compile):
CREATE OR REPLACE VIEW vw_AUD_OBLIGATIONS
(Action_Date, Action_Type, Action_User, Modified_Data)
AS
SELECT actDate,actType, emp,modData
FROM proc_AUD_OBLIGATIONS
END;
Any thoughts on how to make this work - it seems like such a simple concept....
Thanks in advance
TonyYou have a couple of misconceptions here. First, you cannot SELECT from a procedure. You need to write a PROCEDURE that INSERTs these columns into a TABLE, then simply SELECT from the TABLE. There are of course many variations, but I hope you get the general idea here.
Greg -
Create table dinamically using java sql types?
Hi! I've an application that reads an XML file. This file contains de definitions of some tables, using java sql types. For example:
<dbtable>
<dbtablename>Name of table</dbtablename>
<dbtablefield>
<name>Name of table field</name>
<type>java.sql.Types.VARCHAR</type>
<length>10</lenght>
<canNull>0</canNull>
<isPK>1</isPK>
</dbtablefield>
</dbtable>That's a little example of one table, with one field. Is a java.sql.Types.VARCHAR (or is equivalent in int), which has a size of 10, it cannot be null and is a primary key for the table.
Now, the lenght, null, and primary keys are not problem at all. What I want to know, is how do I create de table using the java.sql.Types. I mean, I don't want to hard code:
String s = "CREATE TABLE name (COLUMN VARCHAR(10)...";Instead, I want to use some "wild cards", as are used in PreparedStatement. The idea of this is that no matter what DB I'm using, I must always be capable of creating the tables not worrying for the DB. I mean, I must be able to create the table in Oracle, SQL Server, DB2, etc., using the same XML and the same java class.
Something like:
String s = "CREATE TABLE name (COLUMN ? (10)...";
someobject.setObject(1,java.sql.Types.VARCHAR);
someobject.execute(); //create tableIs this possible? Or do I have to make a map for each DB?
Thanks a lot for your help! Dukes available!you can provide some fields at runtime..
for example
"CREATE TABLE name (COLUMN" + arg[1] +"(10)..."
here arg is the string array passed into the main. -
Start one job after another complets using PL/SQL procedure and DBMS_JOB
All,
I am attempting to refresh a materialized view using DBMS_JOB and having a PL/SQL program loop through each materialized view name that resides in a table I created. We do the table because they have to be refreshed in a specific order and I utilize the ORDER_OF_REFRESH column to dictate which MV comes first, second, third, etc.
Now - I have this working to the extent that it kicks off 4 materialized views (currently set the procedure to only do 4 MVs for testing purposes) but I would ultimately like the procedure to create a new DBMS_JOB that calls DBMS_MVIEW.REFRESH of the next view in line ONLY after the preceeding materialized view DBMS_JOB completes.
The purpose of all of this is to do a few things. One - if I simply create a procedure with the DBMS_MVIEW.REFRESH call to each materialized view in order - that works but if one fails, the job starts over again and will up to 16 times - BIG PROBLEM. Secondly, we want the job that will call this procedure to fail if it encounters 2 failures on any one materialized view (because some MVs may be dependant upon that data and cannot use old stale data).
This may not be the "best" approach but I am trying to make the job self-sufficient in that it knows when to fail or not, and doesn't kick off the materialized views jobs all at once (remember - they need to start one after the other - in order).
As you can see near the bottom, my logic doesn't work quite right. It kicks off all four jobs at once with the date of the whatever LAST_REFRESH is in my cursor (which ultimately is from the prior day. What I would like to happen is this:
1.) 1st MV kicks off as DBMS_JOB and completes
2.) 2nd MV kicks off with a start time of 3 seconds after the completion of 1st MV (based off LAST_REFRESH) date.
3.) This conitnues until all MVs are refresh or until 2 failures are encountered, in which no more jobs are scheduled.
- Obviously I am having a little bit of trouble with #2 and #3 - any help is appreciated.
CREATE OR REPLACE PROCEDURE Next_Job_Refresh_Test2 IS
V_FAILURES NUMBER;
V_JOB_NO NUMBER;
V_START_DATE DATE := SYSDATE;
V_NEXT_DATE DATE;
V_NAME VARCHAR2(30);
V_DELIMITER VARCHAR2(1);
CURSOR MV_LIST IS SELECT DISTINCT A.ORDER_OF_REFRESH,
A.MV_OBJECT_NAME
FROM CATEBS.DISCO_MV_REFRESH_ORDER A
WHERE A.ORDER_OF_REFRESH < 5
ORDER BY A.ORDER_OF_REFRESH ASC;
CURSOR MV_ORDER IS SELECT B.ORDER_OF_REFRESH,
B.MV_OBJECT_NAME,
A.LAST_REFRESH
FROM USER_SNAPSHOTS A,
DISCO_MV_REFRESH_ORDER B
WHERE A.NAME = B.MV_OBJECT_NAME
ORDER BY B.ORDER_OF_REFRESH ASC;
BEGIN
FOR I IN MV_LIST
LOOP
IF I.ORDER_OF_REFRESH = 1
THEN V_START_DATE := SYSDATE + (30/86400); -- Start job one minute after execution time
ELSE V_START_DATE := V_NEXT_DATE;
END IF;
V_FAILURES := 0;
V_JOB_NO := 0;
V_NAME := I.MV_OBJECT_NAME;
V_DELIMITER := '''';
DBMS_JOB.SUBMIT(V_JOB_NO,'DBMS_MVIEW.REFRESH(' || V_DELIMITER || V_NAME || V_DELIMITER || ');',V_START_DATE,NULL);
SELECT JOB, FAILURES INTO V_JOB_NO, V_FAILURES
FROM USER_JOBS
WHERE WHAT LIKE '%' || V_NAME || '%'
AND SCHEMA_USER = 'CATEBS';
IF V_FAILURES = 3
THEN DBMS_JOB.BROKEN(V_JOB_NO,TRUE,NULL); EXIT;
END IF;
FOR O IN MV_ORDER
LOOP
IF I.ORDER_OF_REFRESH > 2
THEN V_NEXT_DATE:= (O.LAST_REFRESH + (3/86400)); -- Start next materialized view 3 seconds after completion of prior refresh
END IF;
END LOOP;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
IF MV_LIST%ISOPEN
THEN CLOSE MV_LIST;
END IF;
NULL;
END Next_Job_Refresh_Test2;
---------------------------------------------------------------------------------------------------------------------Justin,
I think I am getting closer. I have a procedure shown just below this that updates my custom table with information from USER_SNAPSHOTS to reflect the time and status of the refresh completion:
CREATE OR REPLACE PROCEDURE Upd_Disco_Mv_Refresh_Order_Tbl IS
V_STATUS VARCHAR2(7);
V_LAST_REFRESH DATE;
V_MV_NAME VARCHAR2(30);
CURSOR MV_LIST IS SELECT DISTINCT NAME, LAST_REFRESH, STATUS
FROM USER_SNAPSHOTS
WHERE OWNER = 'CATEBS';
BEGIN
FOR I IN MV_LIST
LOOP
V_STATUS := I.STATUS;
V_LAST_REFRESH := I.LAST_REFRESH;
V_MV_NAME := I.NAME;
UPDATE DISCO_MV_REFRESH_ORDER A SET A.LAST_REFRESH = V_LAST_REFRESH
WHERE A.MV_OBJECT_NAME = V_MV_NAME;
COMMIT;
UPDATE DISCO_MV_REFRESH_ORDER A SET A.REFRESH_STATUS = V_STATUS
WHERE A.MV_OBJECT_NAME = V_MV_NAME;
COMMIT;
END LOOP;
END Upd_Disco_Mv_Refresh_Order_Tbl;
Next, I have a "new" procedure that does the job creation and refresh show just below this which, when starting the loop, sets the LAST_REFRESH date in my table to NULL and the STATUS = 'INVALID'. Then if the order of refresh = 1 then it uses SYSDATE to submit the job and start right away, else if it's not the first job, it uses V_NEXT_DATE. Now, V_NEXT_DATE is equal to the LAST_REFRESH date from my table when the view has completed and the V_PREV_STATUS = 'VALID'. I think tack on 2 seconds to that to begin my next job.... See code below:
CREATE OR REPLACE PROCEDURE Disco_Mv_Refresh IS
V_FAILURES NUMBER;
V_JOB_NO NUMBER;
V_START_DATE DATE := SYSDATE;
V_NEXT_DATE DATE;
V_NAME VARCHAR2(30);
V_PREV_STATUS VARCHAR2(7);
CURSOR MV_LIST IS SELECT DISTINCT A.ORDER_OF_REFRESH,
A.MV_OBJECT_NAME,
A.LAST_REFRESH,
A.REFRESH_STATUS
FROM CATEBS.DISCO_MV_REFRESH_ORDER A
WHERE A.ORDER_OF_REFRESH <= 5
ORDER BY A.ORDER_OF_REFRESH ASC;
BEGIN
FOR I IN MV_LIST
LOOP
V_NAME := I.MV_OBJECT_NAME;
V_FAILURES := 0;
UPDATE DISCO_MV_REFRESH_ORDER SET LAST_REFRESH = NULL WHERE MV_OBJECT_NAME = V_NAME;
UPDATE DISCO_MV_REFRESH_ORDER SET REFRESH_STATUS = 'INVALID' WHERE MV_OBJECT_NAME = V_NAME;
IF I.ORDER_OF_REFRESH = 1
THEN V_START_DATE := SYSDATE;
ELSE V_START_DATE := V_NEXT_DATE;
END IF;
DBMS_JOB.SUBMIT(V_JOB_NO,'DBMS_MVIEW.REFRESH(' || '''' || V_NAME || '''' || '); BEGIN UPD_DISCO_MV_REFRESH_ORDER_TBL; END;',V_START_DATE,NULL);
SELECT A.REFRESH_STATUS, A.LAST_REFRESH INTO V_PREV_STATUS, V_NEXT_DATE
FROM DISCO_MV_REFRESH_ORDER A
WHERE (I.ORDER_OF_REFRESH - 1) = A.ORDER_OF_REFRESH;
IF I.ORDER_OF_REFRESH > 1 AND V_PREV_STATUS = 'VALID'
THEN V_NEXT_DATE := V_NEXT_DATE + (2/86400);
ELSE V_NEXT_DATE := NULL;
END IF;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
IF MV_LIST%ISOPEN
THEN CLOSE MV_LIST;
END IF;
NULL;
END Disco_Mv_Refresh;
My problem is that it doesn't appear to be looping to the next job. It worked succesfully on the first job but not the subsequent jobs (or materialized views in this case).... Any ideas? -
How to create a Folder using a SQL Query?
Hi
How can I create a Folder (eg. C:\MyNewFolder) using SQL Query?Hi,
I added some code in order to get the result from the xp_cmdshell command
This returns null if successfull, if an error occurs returns the error message. May be useful instead of getting an sql error
Code Snippet
declare @cmdpath nvarchar(60), @Location nvarchar(100), @message nvarchar(max)
set @Location = N'C:\Temp\Temp5'
set @cmdpath = 'MD '+ @Location
Create table #result
result nvarchar(255)
insert into #result (result) exec master.dbo.xp_cmdshell @cmdpath
select @message = ISNULL(@message + ' - ','') + result from #result where result is not null
select @message
drop table #result
Eralper
http://www.kodyaz.com -
Creating a user with "create user" privilege using PL/SQL?
I have managed to use the PL/SQL DBMS_LDAP package to create and modify OID users (DBMS_LDAP.add_s and DBMS_LDAP.modify_s).
The question is: How can I use DBMS_LDAP to assign privileges to OID users? By "privileges" I mean options like the following (i.e. the options you can enable/disable for any OID user if you login to OIDDAS and click the "privileges" button for a particular user):
Allow user creation
Allow user editing
Allow user deletion
Allow group creation
Allow group editing
Allow group deletion
Allow privilege assignment to users
Allow privilege assignment to groups
AndySolution found.
In case anyone comes back to this thread in the future looking to achieve a similar thing: Metalink 205315.1 contains details. -
I've the following header and http request.
POST http://deab/DexNETWebServices_4_0_0_4/LoginService.svc HTTP/1.1
MIME-Version: 1.0
Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"
VsDebuggerCausalityData: uIDPo5F/qXRc4YJImqB6Ard30cQAAAAAAjIXinpIVUulXLJOsSG7yyv7Lf2yHgpHlIxvc6oeqaAACQAA
Host: deab
Content-Length: 1017
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/ILoginService/LoginByUserName</a:Action><a:MessageID>urn:uuid:cf410a05-23d4-4b92-a22c-329cbc19fbe7</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://deab/DexNETWebServices_4_0_0_4/LoginService.svc</a:To></s:Header><s:Body><LoginByUserName xmlns="http://tempuri.org/"><systemId>19e0ddb4-5fa5-41ee-b624-aea762865a6c</systemId><strName>FirmwareUpdateLogQueryWorker</strName><productId>0af39a3e-6549-485b-872f-b73413203998</productId><password>abc</password></LoginByUserName></s:Body></s:Envelope>
--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1--
I'm using the following code to set the header from PL/SQL and call the request. But UTL_HTTP.get_response returns the error 400 Bad Request.
DECLARE
l_request CLOB;
l_http_req UTL_HTTP.req;
l_http_resp UTL_HTTP.resp;
v_buffer VARCHAR2 (32767);
p_status_code NUMBER (9);
p_error_message VARCHAR2 (32767);
p_response CLOB;
BEGIN
l_request :=
'--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1'
|| CHR (13)
|| 'Content-ID: <http://tempuri.org/0>'
|| CHR (13)
|| 'Content-Transfer-Encoding: 8bit'
|| CHR (13)
|| 'Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"'
|| CHR (13)
|| CHR (13)
|| '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/ILoginService/LoginByUserName</a:Action><a:MessageID>urn:uuid:cf410a05-23d4-4b92-a22c-329cbc19fbe7</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://deab/DexNETWebServices_4_0_0_4/LoginService.svc</a:To></s:Header><s:Body><LoginByUserName xmlns="http://tempuri.org/"><systemId>'
|| '19e0ddb4-5fa5-41ee-b624-aea762865a6c'
|| '</systemId><strName>'
|| 'FirmwareUpdateLogQueryWorker'
|| '</strName><productId>'
|| '0af39a3e-6549-485b-872f-b73413203998'
|| '</productId><password>'
|| 'abc'
|| '</password></LoginByUserName></s:Body></s:Envelope>'
|| CHR (13)
|| '--uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1--';
DBMS_OUTPUT.put_line ('request ' || l_request);
l_http_req := UTL_HTTP.begin_request ('http://deab/DexNETWebServices_4_0_0_4/LoginService.svc', 'POST', 'HTTP/1.1');
UTL_HTTP.set_header (l_http_req, 'MIME-Version', '1.0');
UTL_HTTP.set_header (
l_http_req,
'Content-Type',
'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e4c19840-745d-45b2-90ca-12d71be4cfd9+id=1";start-info="application/soap+xml"');
-- UTL_HTTP.set_header (l_http_req, 'Content-ID', '<http://tempuri.org/0>');
-- UTL_HTTP.set_header (l_http_req, 'Content-Transfer-Encoding', '8bit');
UTL_HTTP.set_header (
l_http_req,
'VsDebuggerCausalityData',
'uIDPo5F/qXRc4YJImqB6Ard30cQAAAAAAjIXinpIVUulXLJOsSG7yyv7Lf2yHgpHlIxvc6oeqaAACQAA');
UTL_HTTP.set_header (l_http_req, 'Content-Length', LENGTH (l_request));
-- UTL_HTTP.set_header (l_http_req,
-- 'SOAPAction',
-- 'http://tempuri.org/ILoginService/LoginByUserName');
UTL_HTTP.write_text (l_http_req, l_request);
DBMS_LOB.createtemporary (p_response, FALSE);
l_http_resp := UTL_HTTP.get_response (l_http_req);
BEGIN
LOOP
UTL_HTTP.read_text (l_http_resp, v_buffer, 32767);
DBMS_OUTPUT.put_line (v_buffer);
DBMS_LOB.writeappend (p_response, LENGTH (v_buffer), v_buffer);
END LOOP;
EXCEPTION
WHEN UTL_HTTP.end_of_body
THEN
NULL;
END;
UTL_HTTP.end_response (l_http_resp);
p_status_code := l_http_resp.status_code;
p_error_message := l_http_resp.reason_phrase;
p_response := REPLACE (p_response, '<', '<');
p_response := REPLACE (p_response, '>', '>');
DBMS_OUTPUT.put_line (
'Status: ' || p_status_code || '-' || p_error_message || ': ' || p_response);
END;
Thank you for your help on this.HI Michiel
I am also trying to achieve something similar to that. I am trying to call a web service that sends an xml attachment over MTOM? Kindly, let me know if this was achievable from your end? I mean how did the issue got resolved.
thanks
vijay -
How to create a database using a SQL statement? Please help.
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.25:1521:mydb","system","12345678");
but mydb database does not exist.
I want to make a connection to oracle server without database name.
How can I do?Colleauge, what is the purpose of making a connection to a non-existent database.
connections are made to the database to retrieve some data or put some data.
for which the database should exists.
so please create the mydb database first using Database Configuration Assistant (DBCA) which is much easier as it is GUI based rather than doing it with sql scripts. -
Creating PDF file using PL/SQL
I am writing a Web PL/SQL package. In this package I would like to create a pdf
file with the data in a table and then display the file on the web. Is there a
way to do this?
Thanks
Rohini AnanthakrishnanNo we are using FOP in our applications, but I always refused to use it ;-)
plpdf looks a lot simpler then FOP by the way (no usless XML code around...;-)
Dim -
Hello All:
I have an requirement of generating a PDF file using Oracle PL SQL program. Can anyone please let me know the procedure/code of doing this?
Thanks,
k Ramesh GuptaI have steps to generate Excel sheet output, apply appropriate content-type for PDF in the PL/SQL written below, to get the same in PDF. i suppose it should be application/pdf
1. Create a custom DAD if required using Enterprise Manager Console of MidTier for HTTP Server or use Portal DAD itself to implement the solution.
2. Create a new procedure (a webdb solution) to stream the HTML for the excel sheet report which will be downloaded.
a. Login to Portal schema through SQL*Plus or the respective DAD based schema if custom DAD is created. (below example is created in custom DAD - 'scott').
SQL>CREATE OR REPLACE
PROCEDURE generateCsv
as
cursor p_emp is select * from PORTAL_DEMO.EMP;
begin
owa_util.mime_header( 'application/vnd.ms-excel', False ); -- Here change the content-type to PDF Format accordingly
htp.print('Content-Disposition: attachment;filename="pvasista.csv"');
owa_Util.Http_Header_Close;
for v_emp_cur in p_emp
LOOP
htp.p (v_emp_cur.ename || ',' || v_emp_cur.deptno || chr(13));
END LOOP;
end;
SQL> grant execute on generateCsv to public;
For education purpose getting the report of employee and deptno of al employees from PORTAL_DEMO.EMP table. Implement the necessary query/ Business Logic accordingly.
b. Now access http://midtier_host:port/pls/dad_name/generateCsv, will download a .csv based excel file report as shown in the screenshot below,
3. Open the Portal Page where the link is to be added, createa URL Item Link and add the above URL, select option "Open in new browser window"
4. It can also be enhanced to have filtering enabled on the report by using Portal Form using Option, "Form based on stored procedure" and selecting the above stored procedure. -
Creating a TreeView using an SQL data source
Hello and how is everyone. I have been coding in Java Windows services and console applications for a couple of years and now I want to start working on some Java Server Pages. I have been reading up on JSP and JSTL. What I want to do is query an SQL database and bring the data into my jsp page and display the data using a TreeView. Can someone help out ? Thanks :)
If you want a tree component on a web page, you will have to use html/javascript to do that.
You can't use swing components in an html page.
Take a look around at javascript tree components (there are several around the net). You then have to write your jsp to generate the correct javascript code to populate that component.
Obviously it all depends on the javascript component that you decide on to display the tree.
Hope this helps,
evnafets
Maybe you are looking for
-
I have had this printer for several years. It worked flawlessly until a unilateral automatic HP firmware update bricked it at the beginning of last year. After months of inactivity, it started working again last week after I deleted and reinstalled e
-
HI, In flat file extraction my Business Scenario is Enhancements to the BI-located GL Account Master Data Table In the NW Natural context the Unit of Measure and Statistical Key Figure Type values are GL Account-specific. In data source maintain scre
-
Strength of cell signal significantly changes
I've noticed the strength of my cell signal significantly changes, it will go from 4 to 5 bars to 1, And I'm not even moving. The reason I moved to AT&T five years ago is that I can look out my home office window and see an AT&T cell tower. I'm aware
-
Please can anyone help. I can receive email but not send. All server details are correct. No problem with iPhone.
-
Why can I not purchase lollipop? I am able to purchase other boosters but not this one. Any suggestions??