Run a PL/SQL statement in an Oracle Alert action?
Hello
did anyone know is it possible to run a PL/SQL statement in an Oracle Alert action?
I can run an SQL like “UPDATE Table SET alert_run = 'ok' where id = 10;” but if I run instead of this the following
“Select XXKN_TEST.UPDATE_XXX_TEST('&USER_NAME') From dual;”
I get the following error log:
Alert: Version : 11.5.0
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
ALECDC module: Check Periodic Alert
PL/SQL procedure successfully completed.
XXKN_TEST.UPDATE_XXX_TEST('GROSS2')
ERROR at line 2:
ORA-00904: "XXKN_TEST"."UPDATE_XXX_TEST": invalid identifier
APP-ALR-04020: Oracle Alert was unable to execute "&VALUE". Check that this file exists and that its read protection is set correctly.
Many thanks for your help,
Alois
Hello Suresh,
I tried your suggestion but it doesn't work.
The PL/SQL procedure was successfully completed but no data was modified.
Are you sure that running a PL/SQL is possible in an alert action?
Kind Regards,
Alois
Similar Messages
-
Can we Run a simple SQL statement from OBIEE Middle Tier node
Hi
i am working in OBIEE 11g environment. Database is installed on one node and Middle tier (BI services ) in other node,
Can i use any utility to run a simple SQL statement from Middle tier ?
Thanks
ReddyAny utility means?
We can create an ODBC connection on the BI server and run the sql.
Mark if helps. -
How to run a single sql statement
I want to run a simple sql statement to get some data in my Controller or AM.
Is there some way, other than creating a VO with the SQL statement, to get some data from the database. My sql query will always return a single row.Hi,
here you have an example I use to call a function in a package (note how you can pass parameters and read results):
Connection conn = this.getOADBTransaction().getJdbcConnection();
OracleCallableStatement ocs = null;
String param = null;
try {
String stmt = "BEGIN :1 := <PkgName>.<FunctionName>(:2); end;";
ocs = (OracleCallableStatement)conn.prepareCall(stmt);
ocs.registerOutParameter(1, OracleTypes.CHAR);
ocs.setString(2, <param>);
ocs.execute();
param = ocs.getString(1);
} catch(SQLException se) {
throw OAException.wrapperException(se);
finally {
try {
ocs.close();
return(param);
} catch(Exception e) {
throw OAException.wrapperException(e);
}Hope this helps you
Bye
Raffy -
How to tune the following sql statements which has two unions in oracle 10g
It takes a long time to run the following sql statement in 10g. Each select brings back about 4 million rows and there will be about 12 million rows. When I run each select statements seprately in sqlplus I can see the data immedaitely but when I run it as whole with two unions in the select it just takes very very long time? I want to know how to make this run faster? Can we add hints? or is it because of any table space? Any help is appreciated.
select
D.EMPLID
,D.COMPANY
,'CY'
,D.CALENDAR_YEAR
,D.QTRCD
,D.ERNCD
,D.MONTHCD
,D.MONTHCD
,D.GRS_MTD
,D.GRS_QTD
,D.GRS_YTD
,D.HRS_MTD
,D.HRS_QTD
,D.HRS_YTD
from PS_EARNINGS_BAL D
where D.SPCL_BALANCE = 'N'
union
select
D.EMPLID
,D.COMPANY
,'FY'
,(case when D.MONTHCD > '06' then D.CALENDAR_YEAR + 1 else D.CALENDAR_YEAR end)
,ltrim(to_char(to_number(D.QTRCD) + decode(sign(3-to_number(D.QTRCD)),1,2,-2),'9'))
,D.ERNCD
,ltrim(to_char(to_number(D.MONTHCD) + decode(sign(7-to_number(D.MONTHCD)),1,6,-6),'09'))
,D.MONTHCD
,D.GRS_MTD
,D.GRS_QTD
,(select sum(F.GRS_MTD) from PS_EARNINGS_BAL F where
F.EMPLID = D.EMPLID and
F.COMPANY = D.COMPANY and
F.ERNCD = D.ERNCD and
F.SPCL_BALANCE = D.SPCL_BALANCE and
(case when F.MONTHCD < '07' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
= (case when D.MONTHCD < '07' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
and to_number(F.MONTHCD) + decode(sign(7-to_number(F.MONTHCD)),1,6,-6)
<= to_number(D.MONTHCD) + decode(sign(7-to_number(D.MONTHCD)),1,6,-6))
,D.HRS_MTD
,D.HRS_QTD
,(select sum(F.HRS_MTD) from PS_EARNINGS_BAL F where
F.EMPLID = D.EMPLID and
F.COMPANY = D.COMPANY and
F.ERNCD = D.ERNCD and
F.SPCL_BALANCE = D.SPCL_BALANCE and
(case when F.MONTHCD < '07' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
= (case when D.MONTHCD < '07' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
and to_number(F.MONTHCD) + decode(sign(7-to_number(F.MONTHCD)),1,6,-6)
<= to_number(D.MONTHCD) + decode(sign(7-to_number(D.MONTHCD)),1,6,-6))
from PS_EARNINGS_BAL D
where D.SPCL_BALANCE = 'N'
union
select
D.EMPLID
,D.COMPANY
,'FF'
,(case when D.MONTHCD > '09' then D.CALENDAR_YEAR + 1 else D.CALENDAR_YEAR end)
,ltrim(to_char(to_number(D.QTRCD)+decode(sign(4-to_number(D.QTRCD)),1,1,-3),'9'))
,D.ERNCD
,ltrim(to_char(to_number(D.MONTHCD)+decode(sign(10-to_number(D.MONTHCD)),1,3,-9),'09'))
,D.MONTHCD
,D.GRS_MTD
,D.GRS_QTD
,(select sum(F.GRS_MTD) from PS_EARNINGS_BAL F where
F.EMPLID = D.EMPLID and
F.COMPANY = D.COMPANY and
F.ERNCD = D.ERNCD and
F.SPCL_BALANCE = D.SPCL_BALANCE and
(case when F.MONTHCD < '10' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
= (case when D.MONTHCD < '10' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
and to_number(F.MONTHCD)+decode(sign(4-to_number(F.MONTHCD)),1,9,-3)
<= to_number(D.MONTHCD)+decode(sign(4-to_number(D.MONTHCD)),1,9,-3))
,D.HRS_MTD
,D.HRS_QTD
,(select sum(F.HRS_MTD) from PS_EARNINGS_BAL F where
F.EMPLID = D.EMPLID and
F.COMPANY = D.COMPANY and
F.ERNCD = D.ERNCD and
F.SPCL_BALANCE = D.SPCL_BALANCE and
(case when F.MONTHCD < '10' then F.CALENDAR_YEAR -1 else F.CALENDAR_YEAR end)
= (case when D.MONTHCD < '10' then D.CALENDAR_YEAR -1 else D.CALENDAR_YEAR end)
and to_number(F.MONTHCD)+decode(sign(4-to_number(F.MONTHCD)),1,9,-3)
<= to_number(D.MONTHCD)+decode(sign(4-to_number(D.MONTHCD)),1,9,-3))
from PS_EARNINGS_BAL D
where D.SPCL_BALANCE = 'N'
Edited by: user5846372 on Mar 11, 2009 8:55 AMHi,
What i observed is that your table name and where clause is same in all the thress SELECTs whereas columns having some manipulations that is not going to be unique. I guess you can easily replace UNION with UNION ALL.
from PS_EARNINGS_BAL D
where D.SPCL_BALANCE = 'N'Note: I am not aware of your data and business requirement. Please test the result before removing. It is just a suggetion
Cheers,
Avinash -
SQL Statement cause delay on exceptional days to run
Hi ,
We are running the same sql statement on daily basis.
5 days a week, it gets completed in 10 mins and once or, twice in a week , it takes 7 – 10 Hrs to execute.
what are the tuning methods and steps we can apply to know the real culprits.
Regards
AsifBefore you dive into reading books and other stuff, you can simply look at the execution plan of your Statement on SQL*PLUS.
It's very easy, just do the following with your SQL Statement on both cases when it takes 10 minutes and hours and compare the results.
DEV@TEST>
DEV@TEST> SET AUTOTRACE TRACEONLY
DEV@TEST>
DEV@TEST> SET TIMING ON
DEV@TEST>
DEV@TEST> SELECT * FROM USER_OBJECTS;
105 rows selected.
Elapsed: 00:00:00.01
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=146 Card=1620 Byte
s=259200)
1 0 VIEW OF 'USER_OBJECTS' (VIEW) (Cost=146 Card=1620 Bytes=25
9200)
2 1 UNION-ALL
3 2 FILTER
4 3 TABLE ACCESS (FULL) OF 'OBJ$' (TABLE) (Cost=146 Card
=1731 Bytes=136749)
5 3 TABLE ACCESS (BY INDEX ROWID) OF 'IND$' (CLUSTER) (C
ost=2 Card=1 Bytes=8)
6 5 INDEX (UNIQUE SCAN) OF 'I_IND1' (INDEX (UNIQUE)) (
Cost=1 Card=1)
7 2 TABLE ACCESS (BY INDEX ROWID) OF 'LINK$' (TABLE) (Cost
=0 Card=1 Bytes=88)
8 7 INDEX (RANGE SCAN) OF 'I_LINK1' (INDEX) (Cost=0 Card
=1)
Statistics
0 recursive calls
0 db block gets
726 consistent gets
0 physical reads
0 redo size
8804 bytes sent via SQL*Net to client
574 bytes received via SQL*Net from client
8 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
105 rows processed
DEV@TEST>You should have an idea why there's a difference in execution time by comparing the results.
Regards,
Tony Garabedian -
Using bind variables with sql statements
We connect from a VB 6.0 program via OO4O to an Oracle 8.1.7 database, using bind variables in connection with select statements. Running ok, but performance again by using bind vars not as good as expected!
When looking into the table v$sqlarea, we were able to detect the reason. We expected that our program submits the sql statement with bind vars, Oracle parses this once, and with each select statement again, we do not have a reparse. But: It seems that with each new session Oracle reparses the sql statement, that is, Oracle is not able to memorize or cache bind vars and statements. Even more worrying, this kind of behaviour was visible with each new dynaset, but the same database/session.
Is there anybody our there with an idea of what is happening here?
Code snippet:
Dim OraSession As OracleInProcServer.OraSessionClass
Dim OraDatabase As OracleInProcServer.OraDatabase
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.OpenDatabase(my database", "my connect", 0&)
OraDatabase.Parameters.Add "my_bind", 0, ORAPARM_INPUT
OraDatabase.Parameters("my_bind").DynasetOption = ORADYN_NOCACHE
OraDatabase.Parameters("my_bind").serverType = ORATYPE_NUMBER ' Bind Var Type
Dim RS As OracleInProcServer.OraDynaset
strSQLstatement= "Select * from my_table where igz= [my_bind] "
Set RS = OraDatabase.CreateDynaset(strSQLstatement, &H4)
OraDatabase.Parameters("my_bind").Value = myValue
RS.Refresh
Cheers and thanks a lot :)
Michael SonntagWe connect from a VB 6.0 program via OO4O to an Oracle 8.1.7 database, using bind variables in connection with select statements. Running ok, but performance again by using bind vars not as good as expected!
When looking into the table v$sqlarea, we were able to detect the reason. We expected that our program submits the sql statement with bind vars, Oracle parses this once, and with each select statement again, we do not have a reparse. But: It seems that with each new session Oracle reparses the sql statement, that is, Oracle is not able to memorize or cache bind vars and statements. Even more worrying, this kind of behaviour was visible with each new dynaset, but the same database/session.
Is there anybody our there with an idea of what is happening here?
Code snippet:
Dim OraSession As OracleInProcServer.OraSessionClass
Dim OraDatabase As OracleInProcServer.OraDatabase
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.OpenDatabase(my database", "my connect", 0&)
OraDatabase.Parameters.Add "my_bind", 0, ORAPARM_INPUT
OraDatabase.Parameters("my_bind").DynasetOption = ORADYN_NOCACHE
OraDatabase.Parameters("my_bind").serverType = ORATYPE_NUMBER ' Bind Var Type
Dim RS As OracleInProcServer.OraDynaset
strSQLstatement= "Select * from my_table where igz= [my_bind] "
Set RS = OraDatabase.CreateDynaset(strSQLstatement, &H4)
OraDatabase.Parameters("my_bind").Value = myValue
RS.Refresh
Cheers and thanks a lot :)
Michael Sonntag -
Does anyone know how to execute a non-sql statement(eg an oracle command).
eg stmt.execute("set define off"); // this doesnt work
Any help will be appreciatedis there any way to overcome this ?Yes, as already pointed out, you use SQL*Plus rather than JDBC. You can use Runtime.exec() and use input and output files (or streams) and drive SQL*Plus anyway that you want.
At the very least that solution is going to be more complicated and it means that the oracle client must be installed on any box that runs your solution.
You would probably be better off looking for a different way to solve your problem using PL/SQL. It probably exists. -
Sort order of german characters in SQL statements
I've a problem concerning the sort order of the german characters 'd'. 'v'. '|' in SQL statements.
Environment : Oracle Server 7.3.4
SINIX 5.43
The statement comes from an Windows application over OCI to the database.
The result of setting the NLS_SORT param to 'German' is that these characters are treated the same as 'a', 'e' and 'u', and not like 'ae', 'oe' and 'ue', as it is expected.
e.g. ascending sort order :
Bube, Bulut, B|schgens, Butza
but expected is: (| = ue)
Bube, B|schgens, Bulut, Butza
Any idea ?
Thanks for any help in advance.If two single quotes don't work, try backslash single quote, like \'
The backslash is often used as an escape character, meaning to treat the next character literally.
- tbob
Inventor of the WORM Global -
SQL statement doesn't return data
Hi,
Please I am facing a problem where I took the sql statement from an oracle report and I'm applying it on TOAD 9.0 but it is not returning any data. The thing is that on the application the report returns data but as I checked on the TOAD it showed that some tables have no data.
How is this possible??
Do I need to apply some code before I apply my select statement??
Hope you can help here,
Thanks in Advance,
AshrafHi Ashraf,
As it should be if a Query in Report is returning data so should the same query return data if used either in Toad or SQL Plus.
In your report do check if you have any parameters and do this parameters have any default values and are you using the same parameters.
Also do check the source of the Report which the application is executing and the one from where you are using the Query is same.
Best Regards
Arif Khadas -
Problems storing sql statement in database
Hi,
I'm writing an application which needs to select a sql statement from an oracle database. The statement should look something like this:
"select id,name,... .from table 1 where id = " + ID + " and name = " + NAME
however when I select this from the database it give a sql error - invalid sql statement, I've tried putting it in the database without quotes, with single quotes etc but I can't seem to get it working.
I'd much appreciate it if any one had any ideas on this.
thanks.debug it: output the sql string to a println or
JTextArea. See what is in it (and test it) . Must be a
null value in the variables.The variables are set previously in the code
I outputted the sql string to the screen but the variable names are not being replaced by the values. -
Expensive SQL statements in EWA
Hi experts,
how can I add expensive SQL statements to Early watch alert reports? In my IDES system this is generated automatically but not for different other systems. Can this be activated by specific settings?
Thanks and best regards, BastiHi bd,
Please check these points:
What database are you using?
What is the version of the ST-SER in your solution manager?
Is the service preparation finished in the managed system(run se38 -> RTCCTOOL to check)?
Have you checked note 1564508?
Besides that, do you see any issue in the SDCCN collection logs for the EWA?
Regards,
Daniel. -
Looking for a sql statement that returns me one row which is made up of data of two rows but display it side by side instead of one row followed by other row.
e.g
Col1
1
2
2 Rows selected
How can i display it as
Col1
1 2
1 Row selected
Appreciate any responses.
TIA
DS
nullHow to find the last sql statement executed in oracle .
thanks
B.B.Padhi
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by SANJAY KUMAR ([email protected]):
i have table san with column rl having values 11, 12. Then write the SQL as:
select a.rl, n.rl from san a,( select b.rl from san b where b.rl in (select rl from san) ) n
where a.rl < n.rl;
It will give u approprate result.
Thanks!<HR></BLOCKQUOTE>
null -
Hi,
I am new to EBS and it's ui.
I would need to fire sql statements on the database.
Is there a interface in EBS from which i can fire sql statements ?
thanks,
ravi.Hi,
I would need to fire sql statements on the database. Use database triggers -- See this thread for a similar discussion.
Can I write custom databse Trigger over a apps table.
Can I write custom databse Trigger over a apps table.
You could also use Oracle Alert -- You can find the user guide at http://www.oracle.com/technology/documentation/applications.html
Is there a interface in EBS from which i can fire sql statements ?All Oracle APIs can be used at [Oracle Integration Repository |http://irep.oracle.com/] website, I am not aware of any API which can be used to fire any SQL statements (I believe such an API does not exists), but you could browse the categories and see if any helps.
Regards,
Hussein -
I have an application that sends SQL statements to an oracle engine using odbc. Is there a way to trace the SQL statements from the unix server that the oracle engine resides on? I do not want to use the trace function in the ODBC data source administrator.
Thanks,
-AlIdebtified your connect and then set trace for session using
exec dbms_system.SET_EV(SID,SERIAL#,10046,12,'');
10046 is event name and 12 is level.
SID and serial# you will get from v$session
Cheer,
Virag Sharma
http://virag.sharma.googlepages.com/ -
SQL statement processed by the optimizer
Hello Experts ;
Any SQL statement processed by Oracle, the optimizer performs the following operations:
Evaluation of expressions and conditions
Inspection of integrity constraints to learn more about the data and optimize based on this metadata
Statement transformation
Choice of optimizer goals
Choice of access paths
Choice of join orders
The Query Optimizer - i got some information from here .
Can i get some more explanations or links for above points ?Hi,
did you have a look at the 11g version?
http://docs.oracle.com/cd/E11882_01/server.112/e41573/optimops.htm#i82005
Andre
Maybe you are looking for
-
HT3702 How to delete credit card info from iTunes account
How to delete credit card info from iTunes account?
-
Songs on ipod randomly disappear but itunes thinks they are still there on ipod
my ipod recently randomly deleted all my songs on my ipod except for an ep i bought directly from my ipod. I had not synced it in a while so that has nothing to do with it. when i did sync it to try and retrieve all my songs, my itunes still acts as
-
"Library" Projects vs "Projects & Albums" Projects
Hello all, I have been using Aperture for about three years. I have Aperture 3 on three different Macs. Prevously I have been using Windows XP and have been storing photos in directories on the hard drive the old fashioned way. I have some questions
-
HT4356 I have a printer 4500 all in one how to print setup printer from to print from my ipad2
I have an iPad 2 and I've been trying to print from my iPad and I am having trouble my printer 4500hp jet ink all in one wifi also it is connector my iMac computer. I can't understand why my iPad does not pick up the wifi printer in my home that is w
-
Hi all, We are running two Novell 6.5 servers and about 40 Windows 2000/XP clients. Also we've got few network printers, all clients connect to them [printers] via windows add printer feature. This works fine but in order for client to use any printe