Retrive perticular mail using PL-SQL procedure
Hi all,
Anyone knows, how to retrive mails from outlook using PL-SQL procedure?
Thanks and Regards
Nilay
The Java library needed by UTL_TCP is not created properly. You may just run $ORACLE_HOME/rdbms/admin/initplsj.sql as SYS to install it:
cd $ORACLE_HOME/rdbms/admin
sqlplus sys/<sys-password> @initplsj.sql
Similar Messages
-
MAIL USING PL/SQL PROCEDURE TCP CONNECTION ERROR
I was trying to send an e-mail using the demo-mail helper package which uses UTL_SMTP package and on execution, it gives the following TCP Connection error. Is it some something to do with mail configuration?
This is the sample code I was trying to run.
demo_mail.mail( sender => 'Me <[email protected]>',
recipients => 'Someone <[email protected]>, ' ||
'"Another one" <[email protected]>',
subject => 'Test', message => 'Hi! This is a test.');
And this is the error I am getting.
class oracle/plsql/net/TCPConnection does not exist
at "SYS.UTL_TCP", line 537
at "SYS.UTL_TCP", line 199
at "SYS.UTL_SMTP", line 102
at "SYS.UTL_SMTP", line 121
at "VNARAYA.DEMO_MAIL", line 159
at "VNARAYA.DEMO_MAIL", line 119
at "VNARAYA.DEMO_MAIL", line 105
at "VNARAYA.SEND_MAIL", line 2
at line 1The Java library needed by UTL_TCP is not created properly. You may just run $ORACLE_HOME/rdbms/admin/initplsj.sql as SYS to install it:
cd $ORACLE_HOME/rdbms/admin
sqlplus sys/<sys-password> @initplsj.sql -
Display data in log file using PL/SQL procedure
Just as srw.message is used in Oracle RDF Reports to display data in log file in Oracle Apps, similarly how it is possible to display data in log file using PL/SQL procedure?
Please also mention the syntax too.Pl post details of OS, database and EBS versions.
You will need to invoke the seeded FND_LOG procedure - see previous discussions on this topic
Enable debug for pl/sql
https://forums.oracle.com/forums/search.jspa?threadID=&q=FND_LOG&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
HTH
Srini -
How to send e-mail using PL/SQL
I need to send e-mail using PL/SQL. Is it possible?
Thanks in advance,
AgnaldoYes. Use the UTL_SMTP package
-
How to insert BLOB datatype image using PL/SQL Procedure and SQL Loader
Hi,
How to insert an image into database using PL/SQL Procedure and also how to insert using SQL Loader. Please help by giving sample code and process description.
Thanks,
Vijay Vhttp://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:232814159006
-
How can i return object from oracle in my java code using pl/sql procedure?
How can i return object from oracle in my java code using pl/sql procedure?
And How can i returned varios rows fron a pl/sql store procedure
please send me a example....
Thank you
nullyes, i do
But i can't run this examples...
my problem is that i want recive a object from a PL/SQL
//procedure callObject(miObj out MyObject)
in my java code
public static EmployeeObj callObject(Connection lv_con,
String pv_idEmp)
EmployeeObj ret = new EmployeeObj();
try
CallableStatement cstmt =
lv_con.prepareCall("{call admin.callObject(?)}");
cstmt.registerOutParameter(1, OracleTypes.STRUCT); // line ocurr wrong
//registerOutParameter(int parameterIndex, int sqlType,String sql_name)
cstmt.execute();
ret = (EmployeeObj) cstmt.getObject(1);
}//try
catch (SQLException ex)
System.out.println("error SQL");
System.out.println ("\n*** SQLException caught ***\n");
while (ex != null)
System.out.println ("SQLState: " + ex.getSQLState ());
System.out.println ("Message: " + ex.getMessage ());
System.out.println ("Vendor: " + ex.getErrorCode ());
ex = ex.getNextException ();
System.out.println ("");
catch (java.lang.Exception ex)
System.out.println("error Lenguaje");
return ret;
Do you have any idea? -
DBI Reports Using PL/SQL Procedure
Hi all,
Is there anyone who worked on Creating a DBI report using a PL/SQL Procedure.
I want to customize a Report that is using Data Source as of type PL/SQL Procedure.
Please Reply to me If anyone has any Idea on this..
Thanks in Advance..Hi Blushadow
Now if i want to update say only 10 records at a time what should i put into my Proc?
Please go thru my Proc below..
CREATE OR REPLACE PROCEDURE PRTS.UPDT_ISSUE_USR_ROLE
As
Cursor cur_user_role Is
Select a.org_id,a.user_id
from prts_user a,issue_user_role b
where a.user_id=b.user_id;
upd_rec cur_user_role%rowtype;
v_rows_processed Number:=0;
Begin
Open cur_user_role;
Loop
Fetch cur_user_role into upd_rec;
If cur_user_role%NOTFOUND
Then
Exit;
Else
update Issue_user_role
set User_org_nm=(Select full_org_nm from VW_Org where org_id=upd_rec.org_id)
Where Issue_User_Role.rowid in
(select issue_user_role.rowid
FROM issue_user_role,issue,issue_workflow,Issue_step_dtl_wrkflw
Where Issue_User_Role.Issue_Id=Issue.Issue_id
And Issue_User_Role.Issue_id=issue_workflow.issue_id
And Issue_User_Role.Workflow_compnt_id=Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID
And Issue_User_Role.Workflow_compnt_id=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
And Issue_User_Role.Issue_id=Issue_Step_Dtl_wrkflw.Issue_Id
And Issue.Issue_id=Issue_workflow.Issue_Id
And Issue.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
And Issue_workflow.Issue_id=Issue_Step_Dtl_Wrkflw.Issue_id
And Issue_Workflow.CURR_STEP_WORKFLOW_COMPNT_ID=Issue_Step_Dtl_wrkflw.Workflow_compnt_id
And issue_workflow.primry_workflow_flag='Y'
And issue_user_role.user_id = upd_rec.user_id
And issue.issue_status_id in (1636,50738,275,50737,2090)
And issue_step_dtl_wrkflw.Issue_step_status_id in (61248,61249,61250));
v_rows_processed :=v_rows_processed + SQL%ROWCOUNT;
If Mod (v_rows_processed,v_rows_processed)=10
then
COMMIT;
End if;END IF;
End Loop;
Commit;
dbms_output.enable(1000000);
dbms_output.put_line('There were '||v_rows_processed||' rows updated');
Close cur_user_role;
End;
I would appreciate if you can let me know any other alternative way to meet this requirment.
Cheers
Vineet -
Use PL/SQL procedure to guard against malformed CSV files before upload
Hi all,
In my CSV upload utility, I've implemented error checking procedures, but they are invoked only AFTER data has been uploaded to temp table. This doesn't catch the following sample scenarios:
1. The CSV is malformed, with some rows shifted due to fields and separators missing here and there.
2. User has chosen a wrong CSV to upload (most likely number of fields mismatch)
I'm wondering if it is a good idea to have procedure to read in the CSV, scan each line, count the number of fields (null fields but with delimiters showing the field exist is ok) for each record. If every single record matches the required number of fields for that table, then the CSV is ok, and the insert from external table to temp table is allow. This will ensure at least the CSV file has a valid matrix size for the target table, but rest of error checking is left until after temp table is populated.
One of my concerns is, I specify "missing field values are null" in the external table parameters, which is necessary since not all fields are required. Does this specification causes a row with missing trailing separators still considered valid? If so then the stored procedure must be programmed to omit such a case.
What do you think? Many thanks.Hi, Cuauhtemoc Amox
Thank you for your advice. I have set web adi using PL SQL interface.
I have decided to go futher
i have a procedure like that
procedure delete_old_data ( p_id in number, p_description in varchar2)
as
begin
begin
if g_flag ='N' then
delete from xx_test;
g_flag='Y';
else null;
end if;
end;
insert into xx_test (p_id,p_descriptiom);
end;
G_FLAG is a global variable with default value ='N' in my package. When web_adi upload
first row from excel sheet, then procedure delete all data from table and change g_flag to 'Y'.
All other rows uploads succesfully; it works fine.
But when user change data in excel sheet and try to upload second time. DELETE_OLD_DATA procedure doesnt work in proper way.
I have found what problem is. when user use same template and try to upload data several times there is same SESSION_ID in database.
i.e. g_flag ='Y' when user try to upload second time. But when user log off and create template again it is work properly.
My question is: How i can different upload attempts? May be there is some id for each upload proccess.
if i can use this ID in my procedure user will have opportunity to use same template.
Thank you -
How to use pl/sql procedure or function as part of validate the entity obj?
Hi,
we are migrating from oracle forms to jdeveloper 11g.
I have a req. that,i wanted to use oracle pl/sql procedure to validate a attribute in an entity created with ADF BC?
Is it possible to implement this?
And how to show the error message from pl/sql procedure?
Regards
Murali.Hi,
It is possible by using a method validator for the entity attribute.
Create a transient attribute 'X'.
In the validation section of the attribute to be validate, choose method validator.
In the Error Message tab set error message as {0}.
Below the value for tokentoken should source.X (X is the transient attribute name)
In the java code of method validator, call the stored procedure and set the value of transient attribute X with the error message from SP.
Use setX("ErrorMessage").
Regards,
Srinidhi -
Retrieve online file as CSV via HTTPS using PL/SQL procedure
Hi all,
Situation:
Server A (not ORACLE)_: accesed via URL, generates dynamically a CSV file and returns to the requestor.
Server B (ORACLE)_: which runs the PL/SQL script. It is the requestor. Read the CSV and store it within ORACLE.
(1) I want to connect from Server B (ORACLE) to an external URL via HTTPS which generates dynamically the CSV file. Subdomain.domain it is the Server A which contains this CSV file.
https://dubdomain.domain/csv_generator.php?query=q1
(2) This file is downloaded to the Server B (ORACLE). A PL/SQL script executed in this machine do the task.
(3) After that, I load this CSV to an ORACLE table which a common CSV PL/SQL parser.
Doubts:
Is it possible to retrieve an online file (a CSV) dynamically created and hosted in a third party server (Not ORACLE) via HTTPS using a PL/SQL procedure executed in a ORACLE server? If the answer is yes, what technology could I use? Any ideas?
Thanks in advance,
YagoAn CSV example in {message:id=10158148}.
For https, two actions are needed in addition.
Firstly, the certificate of the https web server needs to be loaded in an Oracle Wallet on your database server. The wallet will have a specific directory location on the server, and will be protected by a password.
Secondly, the PL/SQL procedure making web call, needs to open the wallet (using <i>UTL_HTTP.set_wallet</i>) using the location and password. Example of that in {message:id=10820182}. -
Unable to update BPEL workflow task using pl/sql procedure
All,
I am on a project which involves APEX/BPEL integration. There is a need to update a workflow task created using pl/sql block of code.
This uses the out of the box TaskQueryService webservice calls and I am getting the below exception.
7,380> <ERROR> <default> <::>
<2009-11-02 04:21:37,380> <ERROR> <default> <::> Cipher decryption error.
<2009-11-02 04:21:37,380> <ERROR> <default> <::> Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::>
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at com.collaxa.cube.util.DESService.decrypt(DESService.java:74)
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at oracle.bpel.services.workflow.verification.impl.VerificationService.decryptString(VerificationService.java:2112)
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> ... 33 more
<2009-11-02 04:21:37,381> <ERROR> <oracle.bpel.services.workflow> <::> Cipher decryption error.
Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
ORABPEL-00007
As an alternative I tried to call the procedure from a Java client and it throws the same exceptions (the workflow context is gotten from the Java API call
workflowContext = taskQueryService.authenticate(WF_MANANAGER_UN, WF_MANANAGER_PW, null, worklistUser);),
however updating the Task from Java using the ora.bpel library API's works perfectly fine.
But the client's requirement is to update taskoutcome from pl/sql.
Please find the exceptions and the code below............. your help is much appreciated.
Procedure Code and details exceptions below...........:
REATE OR REPLACE PROCEDURE PR_UPDATE_TASK_FLOW (P_CONTEXT VARCHAR2, P_TASK_ID VARCHAR2)
AS
soap_respond VARCHAR2(30000);
http_req UTL_HTTP.REQ;
http_resp UTL_HTTP.RESP;
launch_url VARCHAR2(240);
l_task_id varchar2(200) := '01647e0505013d7c:25e029b2:124ae1076ef:-7d29';
l_context varchar2(2000) := '9xReYA5T2NJegzDAVBQl8qNFjFxETMKVK6Y7L5Tz+ZmEG/Mu3BIfABrZG4UeLDlSqqFy/nvYWsjhPoDR+qdgoMBgfEhokt93rPOA/tChlGcI2lOCp5ww0FqKdjii99QFjOjO3c9Vqwghax2h+IvK0hWshBja0lecuc05epm6gpiHt3FFKILOMXbmZ6nR3P+eRAhWsTR7B6FBnw3Xr5QOHQ==';
l_endpoint_url VARCHAR2(200);
l_bpel_action VARCHAR2(100);
l_soap_envelop VARCHAR2(2000) := '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://xmlns.oracle.com/bpel/workflow/taskService">
<updateOutcomeOfTasks xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">
<workflowContext xmlns="http://xmlns.oracle.com/bpel/workflow/common">
<token xmlns="http://xmlns.oracle.com/bpel/workflow/common">P_CONTEXT</token>
</workflowContext>
<taskId xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">P_TASK_ID</taskId>
<outcome xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">COMPLETE</outcome>
</updateOutcomeOfTasks>
</soap:Body>
</soap:Envelope>';
BEGIN
HTTP_REQ:= UTL_HTTP.BEGIN_REQUEST
TRIM('http://soaapn1.mrc.co.la.ca.us:7777/integration/services/TaskService/TaskServicePort')
,'POST'
,'HTTP/1.1'
UTL_HTTP.SET_HEADER(http_req, 'Content-Type', 'text/xml') ;
UTL_HTTP.SET_HEADER(http_req, 'Content-Length', LENGTH(l_soap_envelop)) ;
UTL_HTTP.SET_HEADER(http_req, 'SOAPAction', 'updateOutcomeOfTasks');
UTL_HTTP.WRITE_TEXT(http_req, l_soap_envelop) ;
http_resp:= UTL_HTTP.GET_RESPONSE(http_req) ;
UTL_HTTP.READ_TEXT(http_resp, soap_respond) ;
UTL_HTTP.END_RESPONSE(http_resp) ;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line(sqlerrm);
END PR_UPDATE_TASK_FLOW;
EXCEPTION MESSAGE:
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> ORABPEL-30504
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::>
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Internal Error in Verification Service.
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Internal Error in Verification Service for user {0}. {1}
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Check the underlying exception and correct the error. Contact oracle support if error is not fixable.
7,380> <ERROR> <default.collaxa.cube.services> <::>
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> Cipher decryption error.
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::>
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at com.collaxa.cube.util.DESService.decrypt(DESService.java:74)
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at oracle.bpel.services.workflow.verification.impl.VerificationService.decryptString(VerificationService.java:2112)
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> ... 33 more
<2009-11-02 04:21:37,381> <ERROR> <oracle.bpel.services.workflow> <::> Cipher decryption error.
Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
ORABPEL-00007All,
I am on a project which involves APEX/BPEL integration. There is a need to update a workflow task created using pl/sql block of code.
This uses the out of the box TaskQueryService webservice calls and I am getting the below exception.
7,380> <ERROR> <default> <::>
<2009-11-02 04:21:37,380> <ERROR> <default> <::> Cipher decryption error.
<2009-11-02 04:21:37,380> <ERROR> <default> <::> Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::>
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at com.collaxa.cube.util.DESService.decrypt(DESService.java:74)
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at oracle.bpel.services.workflow.verification.impl.VerificationService.decryptString(VerificationService.java:2112)
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> ... 33 more
<2009-11-02 04:21:37,381> <ERROR> <oracle.bpel.services.workflow> <::> Cipher decryption error.
Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
ORABPEL-00007
As an alternative I tried to call the procedure from a Java client and it throws the same exceptions (the workflow context is gotten from the Java API call
workflowContext = taskQueryService.authenticate(WF_MANANAGER_UN, WF_MANANAGER_PW, null, worklistUser);),
however updating the Task from Java using the ora.bpel library API's works perfectly fine.
But the client's requirement is to update taskoutcome from pl/sql.
Please find the exceptions and the code below............. your help is much appreciated.
Procedure Code and details exceptions below...........:
REATE OR REPLACE PROCEDURE PR_UPDATE_TASK_FLOW (P_CONTEXT VARCHAR2, P_TASK_ID VARCHAR2)
AS
soap_respond VARCHAR2(30000);
http_req UTL_HTTP.REQ;
http_resp UTL_HTTP.RESP;
launch_url VARCHAR2(240);
l_task_id varchar2(200) := '01647e0505013d7c:25e029b2:124ae1076ef:-7d29';
l_context varchar2(2000) := '9xReYA5T2NJegzDAVBQl8qNFjFxETMKVK6Y7L5Tz+ZmEG/Mu3BIfABrZG4UeLDlSqqFy/nvYWsjhPoDR+qdgoMBgfEhokt93rPOA/tChlGcI2lOCp5ww0FqKdjii99QFjOjO3c9Vqwghax2h+IvK0hWshBja0lecuc05epm6gpiHt3FFKILOMXbmZ6nR3P+eRAhWsTR7B6FBnw3Xr5QOHQ==';
l_endpoint_url VARCHAR2(200);
l_bpel_action VARCHAR2(100);
l_soap_envelop VARCHAR2(2000) := '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body xmlns:ns1="http://xmlns.oracle.com/bpel/workflow/taskService">
<updateOutcomeOfTasks xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">
<workflowContext xmlns="http://xmlns.oracle.com/bpel/workflow/common">
<token xmlns="http://xmlns.oracle.com/bpel/workflow/common">P_CONTEXT</token>
</workflowContext>
<taskId xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">P_TASK_ID</taskId>
<outcome xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">COMPLETE</outcome>
</updateOutcomeOfTasks>
</soap:Body>
</soap:Envelope>';
BEGIN
HTTP_REQ:= UTL_HTTP.BEGIN_REQUEST
TRIM('http://soaapn1.mrc.co.la.ca.us:7777/integration/services/TaskService/TaskServicePort')
,'POST'
,'HTTP/1.1'
UTL_HTTP.SET_HEADER(http_req, 'Content-Type', 'text/xml') ;
UTL_HTTP.SET_HEADER(http_req, 'Content-Length', LENGTH(l_soap_envelop)) ;
UTL_HTTP.SET_HEADER(http_req, 'SOAPAction', 'updateOutcomeOfTasks');
UTL_HTTP.WRITE_TEXT(http_req, l_soap_envelop) ;
http_resp:= UTL_HTTP.GET_RESPONSE(http_req) ;
UTL_HTTP.READ_TEXT(http_resp, soap_respond) ;
UTL_HTTP.END_RESPONSE(http_resp) ;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line(sqlerrm);
END PR_UPDATE_TASK_FLOW;
EXCEPTION MESSAGE:
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> ORABPEL-30504
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::>
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Internal Error in Verification Service.
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Internal Error in Verification Service for user {0}. {1}
<2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Check the underlying exception and correct the error. Contact oracle support if error is not fixable.
7,380> <ERROR> <default.collaxa.cube.services> <::>
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> Cipher decryption error.
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::>
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at com.collaxa.cube.util.DESService.decrypt(DESService.java:74)
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at oracle.bpel.services.workflow.verification.impl.VerificationService.decryptString(VerificationService.java:2112)
<2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> ... 33 more
<2009-11-02 04:21:37,381> <ERROR> <oracle.bpel.services.workflow> <::> Cipher decryption error.
Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
ORABPEL-00007 -
Hi!
Can I check e-mail address to use PL/SQL?It's easy enough to check that a vaild e-mail has been entered by using regular expressions to check the mask. However, I fear that using SMTP to perform online validation is not a viable proposition.
By its very nature, e-mail is asynchronous: you have to send an e-mail and wait for it to be either bounced or acknowledged. Certainly, if you're intending to do this over IP you may have a long wait. Furthermore, what if the user's e-mail service is temporarily down. Besides, if a user wants to, they could use one of the e-mail services that provide disposable, one-use addresses.
To actually answer your question :)
PL/SQL has an e-mail package - UTL_SMTP - that's good for automatically generating and sending e-mail messages from within the database. As you want to do something more sophisticated I think you'll need to investigate an OS based solution or build an application using JavaMail.
Cheers, APC -
Retriving unread mails using JavaMail api...
Hi everyone, I am developing a swing GUI application using Java Netbeans and I want to develop a mail client which retrieves mails using Javamail api. Can anyone suggest me how I can implement the code to retrive the same.
Did you bother reading anything before posting that question?
-
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? -
Using PL/SQL procedure and function
In a page i have a VO that uses a Where clause that looks like this
WHERE attr=package.function
where the function returns a value of an internal variable valued by another procedure in the package which considers only the Dbuser DBSchema as parameters.
Do i have to call the procedure in a method like initializeBindigsForPage or i have to put it in another place? And in which mode?
Thanks Marcohi satish,
i tried ur suggestion, but its shows error like
declare
o1 number;
total_bytes number;
o3 number;
unused_bytes number;
o5 number;
o6 number;
o7 number;
b number:=0;
str varchar2(2000);
cursor name is select TNAME FROM TAB WHERE TABTYPE='TABLE';
begin
FOR VAL IN name
LOOP
DBMS_SPACE.UNUSED_SPACE('XMLUSER',VAL.TNAME,'TABLE',o1,total_bytes,o3,unused_bytes,o5,o6,o7);
--dbms_output.put_line(VAL.TNAME);
--dbms_output.put_line(total_bytes);
--dbms_output.put_line(unused_bytes);
EXECUTE IMMEDIATE 'select count(*) from '||VAL.TNAME||' ' RETURNING into b;
--select count(*) into b from VAL.TNAME;
--execute immediate(str);
dbms_output.put_line(b);
insert into space values(VAL.TNAME,total_bytes,unused_bytes,b);
END LOOP;
end;
SQL> @space.sql
declare
ERROR at line 1:
ORA-06547: RETURNING clause must be used with INSERT, UPDATE, or DELETE
statements
ORA-06512: at line 19
wat goes wrong satish?
Maybe you are looking for
-
Home (task) Screen Question
Just updated to the new 10.3.2 OS last night. The home (task) screen used to only be active when there were active apps running in the background, and once all apps were closed, it returned to the apps screen or Hub, and the Home (tasks) screen woul
-
Does anyone know if I can set up a printer and make a desktop printer icon for it if I don't actually have the printer connected to my computer? Please give any tips if you know of them
-
i have i phone 5 but wake up button not work efficiently. i live in turkey but i bought in UAE. i want to learn guarantee condition.
-
Collection Alerting for Endpoint Protection and Client Status
both for the Client Status alerts and for the Endpoint Protection alerts I have set these up on one collection each, the thing is if you go to the Client Status node under monitoring, by default the collection 'All desktop and server clients' is sele
-
Catalog group code data - is it Master data or Configuration data
Hi all, Need some clarifications between Master Data and Configuration data. In CRM we use catalog code groups and codes for ticketing systems. The code groups and codes are defined in SPRO (IMG) once and consumed in catalog schema's at client level.