Displaying a Message from PL/SQL block to Java Application
Hi
How can One display or populate a message in Java Application, that is generated from a PL/SQL block?
Well, the easiest option would be to have a "message" parameter that gets passed back from the PL/SQL block to the calling Java application.
I'm guessing, though, that you wouldn't be asking the question if the easy solution was a viable option... If that's the case, you're going to have to describe the problem in a bit more detail...
Justin
Similar Messages
-
Display an Alert message from PL/SQL block in APEX
Hi,
we are getting an oracle exception while inserting a new row. As it is having the unique constaint on a coulumn.
Now the problem iis we need to Display an "Alert message" based on the input field validation. That java script code for alert has to be embeded nside a PL/SQL block in Oracle APEX Application.
we tried doing this with below code:
Begin
INSERT INTO <<table name>>(ID,NAME) VALUES (s1,:TXT_s2);
exception when others then
htp.p('<script language="javascript">');
htp.p('alert("Exception");');
htp.p('</script>');
end;
If anybody knows .... please reply.
Thanks,
SubarnaIf your end goal is showing a pretty error message instead of the message that the tables unique constraint raises try the following. This logic will show a nice message and not try to insert non-unique data.
(1) Create a validation of type "Function Returning Error Text".
(2) Place similar code like the following in your validation. Notice that if the unique name does not exist the no_data_found returns null allowing the validation to pass.
DECLARE
v_error varchar2(100);
BEGIN
SELECT 'A person by this name already exists.'
INTO v_error
FROM your_table
WHERE your_name = :P1_YOUR_NAME;
RETURN v_error;
EXCEPTION
WHEN no_data_found THEN
RETURN NULL;
END; -
A way to display error messages from the program
Dear all,
I am looking forward to display a set of error messages(in a internal table) during the execution of the program to the user.
I wanted to know the better way of displaying error messages from my program with more options.
Well I tried out using displaying errors as ALV list/Grid or as simple list processing.
But I found some stanadard transactions (Like in MM and FI where errors are shown in a better way, but failed to find out how they are done.
Please guide me.
Thanks in advance
AryanTry to use application logging it has a very good way to display a set of messages.
[http://abap4.tripod.com/Using_Application_Logging.html|http://abap4.tripod.com/Using_Application_Logging.html]
Run this report in se38 an example sap report to understand logging way to show a set of messages
Report Name : SBAL_DEMO_01
Edited by: Vighneswaran CE on Dec 19, 2010 3:01 PM
Edited by: Vighneswaran CE on Dec 19, 2010 3:11 PM -
I got a message from Verizon saying that my email application has been blocked and I can't figure out how to unblock this so I can see email. I will not be able to see any response you send, so can you send it to my husband's email: [email protected] Thanks.
Open iPhoto, then under iPhoto on the menu bar, choose Preferences, then Accounts.
Make sure the email account is setup just like in Mail...just checked mine and it had dropped the password (added that back in) and it had changed the port to a default 25 (changed that back to match Mail). Now it works correctly. -
Display error message from SLG1 on shopping cart screen
I have implemented a 'BBP_CATALOG_TRANSFER' badi. I am adding all the custom error messages in ET_SC_MESSAGES export parameter of this badi. As a result of this, all the custom error messages added in the above parameter, gets logged in the application log SLG1 automatically and I can see those custom messages in SLG1. Now how to display this message from SLG1 on the shopping cart screen on the top where you normally see standard error messages in red.
Can anyone please help me on this?
Thanks,
KrupaHi
Which SRM version are you using ?
I have not tried this... but I think this is not possible to display error messages
using BBP_CATALOG_TRANSFER BADI.
<u>Try to code your logic in using BBP_DOC_CHECK_BADI for filter type - BUS2121 (shopping cart). You need to add your custom message in ET_MESSAGES [] table.</u>
<b>For sample coding, refer to the link below -></b>
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/srm/bbp_doc_check_badi-CheckPurchasingDocument&
<b>Hope this will definitely help.</b>
Do let me know.
Regards
- Atul -
How to send JMS message from pl/SQL to jBoss
Hi all,
I need a helping. This is my problem:
There's a queue which is definitied under the Jboss. I would like send a message from pl/SQL to jBoss.
Why is't working??
http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/jms/Readme.html
thnk's,
fgy,,You can defince a queue in Oracle, then access this queue from your Jboss application. Not sure if you need JMS, but there are some Oracle OCI functions that are certainly helpful for such a task.
You might look into further details be reading the manual on Oracle Advanced Queuing or Oracle Streams.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14257/part4.htm#i436427 -
Calling sql script from pl/sql block
Hi
I want to call a sql script from pl/sql block.
like
CREATE OR REPLACE procedure DataBaseExport(user_name in varchar2, pwd in varchar2)
as
begin
execute immediate '@ C:\Documents and Settings\umesh\emp.sql';
end DataBaseExport;
/Try something like this -
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
import java.io.*;
public class Host
public static void executeCommand(String command)
try {
String[] finalCommand;
if (isWindows())
finalCommand = new String[4];
// Use the appropriate path for your windows version.
finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; // Windows XP/2003
//finalCommand[0] = "C:\\winnt\\system32\\cmd.exe"; // Windows NT/2000
finalCommand[1] = "/y";
finalCommand[2] = "/c";
finalCommand[3] = command;
else
finalCommand = new String[3];
finalCommand[0] = "/bin/sh";
finalCommand[1] = "-c";
finalCommand[2] = command;
final Process pr = Runtime.getRuntime().exec(finalCommand);
pr.waitFor();
new Thread(new Runnable()
public void run()
BufferedReader br_in = null;
try
br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String buff = null;
while ((buff = br_in.readLine()) != null)
System.out.println("Process out :" + buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_in.close();
catch (IOException ioe)
System.out.println("Exception caught printing process output.");
ioe.printStackTrace();
finally
try {
br_in.close();
} catch (Exception ex) {}
).start();
new Thread(new Runnable()
public void run()
BufferedReader br_err = null;
try
br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
String buff = null;
while ((buff = br_err.readLine()) != null)
System.out.println("Process err :" + buff);
try
Thread.sleep(100);
} catch(Exception e) {}
br_err.close();
catch (IOException ioe)
System.out.println("Exception caught printing process error.");
ioe.printStackTrace();
finally
try
br_err.close();
catch (Exception ex) {}
).start();
catch (Exception ex)
System.out.println(ex.getLocalizedMessage());
public static boolean isWindows()
if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
return true;
else
return false;
CREATE OR REPLACE PROCEDURE Host_Command (p_command IN VARCHAR2)
AS LANGUAGE JAVA
NAME 'Host.executeCommand (java.lang.String)';
--- THE PERMISSIONS ---
call dbms_java.grant_permission('SYSTEM', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');And, finally,
create or replace procedure call_sql_file(usr in varchar2,
pwd in varchar2,
host_str in varchar2)
is
begin
host('sqlplus -s usr/pwd@host_str C:\UAX_Auto_Count.sql');
exception
when others then
dbms_output.put_line(sqlerrm);
end;Now, you can pass all the argument in order to execute that file.
N.B.: Not Tested...
Regards.
Satyaki De. -
Is it possible to call a windows batch file from PL/SQL block ??
Hi gurus,
Would require your help.Is it possible to call a windows batch file from PL/SQL block ??If yes can you give an example for the same or any workaround for the same.
Regards
VijayYou didn't specify a database version, but if you are 10g or higher, it's quite straightforward using an external job type in DBMS_SCHEDULER. Funnily enough i'm looking at something similar myself at the moment.
Useful guide to some of the issues here Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files -
Sending message from PL/SQL procedure to form
Hello Friends,
How can I send messages from PL/SQL procedure to Form ?
Ultimate target is catching progress of PL/SQL procedure from
form. I heard about DBMS_PIPe but not sure,.
AdiHello,
Yeah , I got the solution using DBMS_PIPE function,I
followed following steps.
1. Pipe is created. see below procedure.
create or replace procedure proc_testpipe as
v_pipe_integer integer;
v_pipe_message integer;
begin
v_pipe_integer := DBMS_PIPE.Create_Pipe('adipipe');
dbms_pipe.pack_message('Hello Adinath Kamode,Message
from Pipe');
v_pipe_message := dbms_Pipe.Send_message('adipipe');
end;
end;
2. then I created one Function which will obtain message from
Pipe and
will return value to form.
create or replace function proc_callpipe return varchar2 as
v_msg integer;
v_rem integer;
v_message varchar2(500);
begin
v_msg:=dbms_pipe.receive_message('adipipe');
dbms_pipe.unpack_message(v_message);
dbms_pipe.purge('adipipe');
v_rem := dbms_pipe.remove_pipe('adipipe');
return(v_message);
end;
3. Last I called this function from form.
Cheers .. !
Adi -
Running sqlldr command from PL/SQL Block
DECLARE
BEGIN
END;In SQL * plus we can run DOS commands using the following command
HOST DIR
HOST DIR/P
But When we can't run the HOST command in PL/SQL Block..
I have to Run sqlldr command from PL/SQL Block..
i tried as follows
DECLARE
BEGIN
EXECUTE IMMEDIATE ' host sqlldr control= bad= ';
END;
By
BalaNagaRaju -
Exec SQLPLUS command from PL/SQL Block
Good Morning:
How I can execute a SQLPLUS command (like SPOOL or DESCRIBE) from PL/SQL Block Procedure?:
DECLARE
BEGIN
ls_command = 'DESCRIBE '||ls_table_name;
EXECUTE SQLPLUS(ls_command);
END;
Thanks a lot for any idea.That's correct.
However, in the case of the given example we can use DBMS_DESCRIBE package to get table descriptions. And we can use UTL_FILE to spool PL/SQL stuff to a file.
Cheers, APC -
Call HOST cmd from PL/SQL Block
Hi ,
I'm trying to call the HOST command from stored procedure
declare
cmd varchar2(100):='c:\file.bat';
begin
execute immediate 'host('c:\file.bat')';
dbms_output.put_line('Executed');
end;
but,It gives an error msg on execute immediate stmt.
Plz resolve this problem.
Rgrds,
AnandYou are confusing SQL*Plus's command (a client) with that of PL/SQL.
Just as you cannot code C# commands, or Perl commands, or PHP commands in PL/SQL, you cannot code SQL*Plus commands in PL/SQL.
SQL*Plus runs on your client platform. It has a couple of commands.
PL/SQL is a server side programming language. This runs inside the Oracle server process servicing the client.
This server process does not know your client language commands. Nor can this server process hack across the network, break into your computer, and access your local file called c:\file.bat.
Yes, you can execute server o/s commands and execute server programs from PL/SQL via a Java stored procedure or via the EXTPROC interface. Refer to the sample code in [url http://forums.oracle.com/forums/thread.jspa?messageID=1439836#1439836]this thread on how to call server o/s commands and server programs. -
Display an Alert message in PL/SQL block in APEX
Hi,
we are getting an oracle exception while inserting a new row. As it is having the unique constaint on a coulumn.
Now the problem iis we need to Display an "Alert message" based on the input field validation. That java script code for alert has to be embeded nside a PL/SQL block in Oracle APEX Application.
we tried doing this with below code:
Begin
INSERT INTO <<table name>>(ID,NAME) VALUES (s1,:TXT_s2);
exception when others then
htp.p('<script language="javascript">');
htp.p('alert("Exception");');
htp.p('</script>');
end;
If anybody knows .... please reply.
Thanks,
Subarna
Edited by: user9955252 on Apr 21, 2010 1:47 AMHello,
APEX Forum is here : Oracle Application Express (APEX)
Regards -
Process wait SQL*Net message from dblink /SQL*Net message from client
Hi There,
We have an ETL process that we kindly need your help with. The process been running since Sun, where it transfers the data from one server (via remote query). The process was running ok till last night where it appeared
to have stopped working and/or the session is just idling doing nothing.
Here are some tests that we did to figure out what's going on:
1. when looking at the session IO, we noticed that it's not changing:
etl_user@datap> select sess_io.sid,
2 sess_io.block_gets,
3 sess_io.consistent_gets,
4 sess_io.physical_reads,
5 sess_io.block_changes,
6 sess_io.consistent_changes
7 from v$sess_io sess_io, v$session sesion
8 where sesion.sid = sess_io.sid
9 and sesion.username is not null
10 and sess_io.sid=301
11 order by 1;
logical physical
SID BLOCK_GETS reads reads BLOCK_CHANGES CONSISTENT_CHANGES
301 388131317 97721268 26687579 223052804 161334
Elapsed: 00:00:00.012. Check there is nothing blocking the session
etl_user@datap> select * from v$lock where sid=301;
ADDR KADDR SID TY ID1 ID2 LMODE REQUEST CTIME BLOCK
684703F0 6847041C 301 DX 35 0 1 0 45237 0
684714C4 684714F0 301 AE 199675 0 4 0 260148 0
619651EC 6196521C 301 TM 52733 0 3 0 45241 0
67F86ACC 67F86B0C 301 TX 458763 52730 6 0 45241 03. Check if the session is still valid:
etl_user@datap> select status from v$session where sid=301;
STATUS
ACTIVE4. Check if there is anything in long ops that has not completed:
etl_user@datap> SELECT SID, SERIAL#, opname, SOFAR, TOTALWORK,
2 ROUND(SOFAR/TOTALWORK*100,2) COMPLETE, TIME_REMAINING/60
3 FROM V$SESSION_LONGOPS
4 WHERE
5 TOTALWORK != 0
6 AND SOFAR != TOTALWORK
7 order by 1;
no rows selected
Elapsed: 00:00:00.005. Check if there is anything in long ops for the session:
etl_user@datap> r
1* select SID,SOFAR,TOTALWORK,START_TIME,LAST_UPDATE_TIME,TIME_REMAINING,MESSAGE from V$SESSION_LONGOPS where sid=301
SID SOFAR TOTALWORK START_TIM LAST_UPDA TIME_REMAINING MESSAGE
301 0 0 22-JUL-12 22-JUL-12 Gather Table's Index Statistics: Table address_etl : 0 out of 0 Indexes done
Elapsed: 00:00:00.00This is a bit odd!! This particular step have actually completed successfully on the 22nd of July, and we don't know why it's still showing in long opps!? any ideas?
6. Looking at the sql and what's it actually doing:
etl_user@datap> select a.sid, a.value session_cpu, c.physical_reads,
2 c.consistent_gets,d.event,
3 d.seconds_in_wait
4 from v$sesstat a,v$statname b, v$sess_io c, v$session_wait d
5 where a.sid= &p_sid_number
6 and b.name = 'CPU used by this session'
7 and a.statistic# = b.statistic#
8 and a.sid=c.sid
9 and a.sid=d.sid;
Enter value for p_sid_number: 301
old 5: where a.sid= &p_sid_number
new 5: where a.sid= 301
CPU physical logical seconds
SID used reads reads EVENT waiting
301 1966595 26687579 97721268 SQL*Net message from dblink 45792
Elapsed: 00:00:00.037. We looked at the remote DB where the data resides on, and we noticed that the remote session was also waiting on the db link:
SYS@destp> select a.sid, a.value session_cpu, c.physical_reads,
2 c.consistent_gets,d.event,
3 d.seconds_in_wait
4 from v$sesstat a,v$statname b, v$sess_io c, v$session_wait d
5 where a.sid= &p_sid_number
6 and b.name = 'CPU used by this session'
7 and a.statistic# = b.statistic#
8 and a.sid=c.sid
9 and a.sid=d.sid;
Enter value for p_sid_number: 388
old 5: where a.sid= &p_sid_number
new 5: where a.sid= 390
SID SESSION_CPU PHYSICAL_READS CONSISTENT_GETS EVENT SECONDS_IN_WAIT
390 136 0 7605 SQL*Net message from client 46101
SYS@destp>We have had an issue in the past where the connection was being dropped by the network when the process runs for few days, hence we have added the following to the sqlnet.ora and listener.ora files:
sqlnet.ora:
SQLNET.EXPIRE_TIME = 1
SQLNET.INBOUND_CONNECT_TIMEOUT = 6000
listener.ora:
INBOUND_CONNECT_TIMEOUT_LISTENER = 6000What else can we do and/or further investigate to work out the root cause of the problem, and may be help resolve this. We don't want to just stop and start the process again as it took few days already. We have
had a chat to the infrastructure team and they've assured us that there have been no network outages.
Also, the alert logs for both instances (local and remote) shows no errors what so ever!
Your input is highly appreciated.
Thanks
Edited by: rsar001 on Jul 25, 2012 10:22 AMRan the query on both local/remote db, and no rows returned:
etl_user@datap> SELECT DECODE(request,0,'Holder: ','Waiter: ')||vl.sid sess, status,
2 id1, id2, lmode, request, vl.type
3 FROM V$LOCK vl, v$session vs
4 WHERE (id1, id2, vl.type) IN
5 (SELECT id1, id2, type FROM V$LOCK WHERE request>0)
6 and vl.sid = vs.sid
7 ORDER BY id1, request
8 /
no rows selected
Elapsed: 00:00:00.21 -
Error while invoking webservice using UTL_HTTP from PL/SQL Block
Hi All,
I am invoking a webservice (SOAP Request) from a PL/SQL block using UTL_HTTP package.
I am able to send the complete request and am getting the required instance on the BPEL Console, but the process is erroring out while getting response back.
and the PL/SQL Block is ending in error mentioned below:
ERROR at line 1:
ORA-29266: end-of-body reached
ORA-06512: at "SYS.UTL_HTTP", line 1321
ORA-06512: at "APPS.CSM_BPEL_TEST_PKG", line 34
ORA-06512: at line 1
Package is completing successfully if i test in local DB and local BPEL.
But giving above error in client's.
Can anyone let me know what is the cause of this.
Thanks in advanceI got it working by making process Synchronous.
But with asynchronous process it is still same error.
Thanks...
Maybe you are looking for
-
I wanted to download apple pages, numbers & keynote. I believe it comes free for iPad mini with retina display bought in Jan 14. But these apps ask for payment in my store and not allowing to download for free. Any help?
-
Please HELP - huge data recovery issues
Hello all, The hard drive on my MacBook (late 2008 unibody, less than a year old, don't get me started) has gone to ****, and I am trying desperately to get the data off of it before I get a replacement. Got it out of the laptop and into an enclosure
-
I am trying to create a Phone Directory for my neighborhood. I have this information in a Numbers document. I created a Pages document in the format I wanted for the directory using the "mail merge" for the fields from the Numbers document. However,
-
My ipod touch just stopped working, help please :(
hi, I need some help with my ipod touch. i was using it and it was working just fine and i locked the screen and walked away came back to use it and the screen wouldn't unlock and it wouldn't even turn on. i plugged it in just to see if it needed to
-
i need help asap pleasseee...i am using 8 tracks multi timbral for stylus rmx...and everything is good but there is one problem, anytime i do anything to one track it does it to the other...for example: if i mute one of the tracks then it mutes all o