Common procedure call from db trigger.
hi all,
i have one procedure, which is called from most of the db-triggers on tables.
while dml operation, db-trigger on table calls this common procedure.
while executing this procedure, i want to know currently, it is called from which trigger and table.
is it possible?
regards.
in that case i have to modify all the triggers on table, which is labourious job.
any other solution.
Similar Messages
-
Need to do a commit in a procedure called from a trigger
How do I get around the need to do a commit in a procedure that is being executed from a trigger. I know it can't be done but I bet someone has a workaround. Thanks.
Hi
Why do you want to do a commit in a procedure called from a trigger?
Anyway if you are running Oracle 8i+ you can declare the procedure as an Autonomous Transaction and can issue a commit, eventhough it is called from a trigger.
HTH
Arvind Balaraman -
Stored Procedure call from JDBC sender for Oracle Database
Hi,
I have a requirement to call stored procedure using JDBC sender adapter for retriving data from an Oracle database.
I need to execute first stored procedure call from Querry SQL statement and then trigger second stored procedure call for confirming the succesful retrival of those records from the update SQL statement.
Querries:
1. Can we trigger stored procedure from Update statement of JDBC sender.
2. Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
3. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
Please note PI does not have direct access to main table and hence the need to have separate stored procedure calls.
The PI version is PI 7.11 sp4.
Appreciate your inputs.
Thanks.
Siddhesh S.Tawate>1. Can we trigger stored procedure from Update statement of JDBC sender.
I think not possible using update statement.
> Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
Yes using select query you can call stored procedure.
>. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
No select and update handles in the same session using the same thread so if one transaction fails update should not proceed. -
Execution Times of Stored Procedures Called from Other Stored Procedures
If I execute sys.dm_exec_procedure_stats, it will produce execution times of my stored procedures executed recently.
However, stored procedures called from other stored procedures do not show up.
Is there code that can return the execution times of stored procedures even though they are called from other stored procedures.Look at the example. It is counting nested execution.
CREATE PROC z1SP AS SELECT * FROM Production.Product;
GO
CREATE PROC z2SP AS SELECT * FROM Production.Product WHERE Color is not null; EXEC z1SP;
GO
SELECT object_name(2002822197), object_name(2034822311);
--z1SP z2SP
EXEC z1SP; EXEC z2SP;
GO 10
SELECT * from sys.dm_exec_procedure_stats
database_id object_id type type_desc cached_time last_execution_time execution_count
16 2002822197 P SQL_STORED_PROCEDURE 2014-12-16 13:02:45.170 2014-12-16 13:02:46.717 20
16 2034822311 P SQL_STORED_PROCEDURE 2014-12-16 13:02:45.460 2014-12-16 13:02:46.687 10
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014 -
MS SQL Procedure Call from Oracle Database
I have Oracle Database 11g connected to MS Sql Server 2008 via dg4msql, and need to execute procedure on MS Sql with parameters from Oracle, and get dataset (table) as a result.
I'm not sure is it possible to call procedure directly from Oracle; One solution would be make function on MS SQL, and put select on procedure from Oracle, but what with parameters?
Is there some possibility to call this procedure from Oracle and get this dataset as a cursor?
Thanks in advance!
Edited by: mihaelradovan on 2012.04.26 14:35Yes, of course I have DB Link in Oracle and procedure in SQL Server.
Btw, I can select data from SQL Server table.
I made one function in SQL Server, and I can not make select on this function, but in SQL Server I made view as select * from function_name, and select on this view from Oracle works. But problem is I have to call this procedure or function with parameters, and with view I can not do this.
So, I must call procedure or function with parameters directly. I made all by the book (Oracle® Database Gateway for SQL Server User’s Guide), but probably I miss something... -
Passing UDT TABLE of VARCHAR as an Input parameter in Stored procedure call from java
I have following Type defined at the schema: ident_arr IS TABLE OF VARCHAR2(100) which is type of one of the input parameters. I am able to create oracle.sql.ARRAY object to map it with this UDT before calling my stored procedure from java. When I execute my stored procedure, I get the following error:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'P_PV_WCC_INSERT'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I have already checked all other parameter types.Hello,
Thank you, guys, for advice. I should have explained calling context before, but what I basically need to do is to see if procedure(arg1, list(record(arg2, arg3))) returns true.
I see array binding wouldn't fit there nicely. Internal procedure calls would be proc(next(arg1), next(arg2), next(arg3)) - if all these return true, external call should also return true. I would need to make a list of repeating values of arg1 and separate list(record(arg2, arg3)) into separate lists. I would also need to record whether the internal call returns true to deduce whether external call returns true.
As I see no better way yet, I'll make Oracle procedure proc(arg1, arg2, arg3) and implement a loop in .NET side. If I optimize for performance, I'll probably pack the array of records into string and pass it for Oracle side to parse.
Regards,
Aurimas Pranskevicius -
Securing Procedure Called from URL
Hello all,
I've read-up on creating procedures that can be called directly via a URL (ie. http://localhost:8080/apex/myschema.helloworld) by granting execute to anonymous and adding "MYSCHEMA.HELLOWORLD" to wwv_flow_epg_include_mod_local. I have a test procedure running.
My question is, does anyone have any suggestions on how one might do this securely? Specifically I'm thinking I'd like to use one of these procedures to generate an XML stream of location information into a Google Map on one of my pages. As long as a user is in the app, I'm good because I know the user logged-in to get there. My concern is that some smart guy would get hold of the URL, pop it in the address bar and now has all the location data which may be sensitive.
Couple things I tried:
- granting execute to just apex_public_user incorrectly thinking that's what an ApEx application runs as (I forgot it runs as anonymous which is the same as someone who isn't logged in at all)
- checking the value of v('APP_SESSION') inside the procedure, thinking if there's a session then the user must have logged-in - but it comes back null whether called from inside or outside the application. I suspect that when calling the procedure via a URL even from inside the app (like thru an iframe in an HTML region), it must kick off a new session.
Any thoughts or suggestions, even something other than using a direct procedure call at all? My main priority is doing this securely.Hi,
I have had similar requirements. I'm not sure I've solved it properly yet, but here's the sort of thing I did:
1 - I updated the procedure to receive a parameter - this will be the ID of the user
2 - In my database, I created a table that holds nothing but the IDs and a datetime value.
3 - When the page loads that the user uses to get to this procedure, I update datetime value for the record for that user to, say, now + 1 minute
4 - When called, the procedure then checks the ID in that table to see if the datetime value is > now - if it is, then the download proceeds, otherwise, nothing
You could probably also do something with a random number created when the page loads. Pass this as another parameter and check it in the process.
Andy -
Database procedure called from Forms
If a database procedure that updates a table is called from Oracle Forms, does it commit the changes automatically or do you have to issue a commit in Forms to commit the changes the database procedure has done, assumming there is no commits in the database procedure.
I'm not sure since I have seen cases where a commit was needed after the database procedure has been called and a case where a commit was needed. I checked the database procedure and there was no commits, there was a commit above the statement where the procedure was being called.<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by NAB ():
If a database procedure that updates a table is called from Oracle Forms, does it commit the changes automatically or do you have to issue a commit in Forms to commit the changes the database procedure has done, assumming there is no commits in the database procedure.
I'm not sure since I have seen cases where a commit was needed after the database procedure has been called and a case where a commit was needed. I checked the database procedure and there was no commits, there was a commit above the statement where the procedure was being called.<HR></BLOCKQUOTE>
Database procedure do have commit. You can issue commit in the procedure itself.
null -
External Procedure call from Trigger
I'd like to call an external C Procedure from
an Oracle Trigger.
In trying to get an example to work, after setting up the listener and tnsnames.ora for external procedures, the following SQL*Plus command behaves strangely:
CREATE LIBRARY TTest as "c:\winnt\system32\TTrigger.dll";
After entering this, the command line prompts for more data as if the command was not terminated. Tried single quotes, double quotes, forward slash, backward slash...
What is wrong with this command?
Thankshi,
COuld you send me the configuration parameters for listner and TNSNAMES? I am working so hard to set it up but getting stuck and I am sure that I am missing some configuration set up.
Please could you mail your tnsname a nd listner files to bellow shown address?
[email protected] ?
Thanks in advance
Suresh -
Error Message from Oracle server while a procedure calling from VB
hi,
when i am calling a procedure some time an error is comming and most of the times the program is working properly. the error showing is as folows
ORA-06550: line 1, column 7:
PLS-00306: wrong number of type of arguments in call to 'PRO_PandL_Exp1'
ORA-06550: line 1, column 7:
PL/SQL:Statement Ignored
i am expressing my extreem thanks for trying to help me and solve the problam
the procedure i written is
CREATE OR REPLACE PROCEDURE PRO_PANDL_EXP1
(companyid in number, Stdate in varchar2, enddate in varchar2, YEARID in number, p_recordset OUT SYS_REFCURSOR ) AS
sdate date;
edate date;
begin
sdate := to_date(Stdate,'dd-mon-yyyy');
edate := to_date(enddate,'dd-mon-yyyy');
open p_recordset for select NVL(sum(dr),0) AS DR , NVL(sum(cr),0) AS CR , NVL(sum(opamt),0) AS OPAMT,
NVL(sum(balamt),0) AS BALAMT, group_name, ORDER_TO_PRINT, GROUP_LEVEL,
TR_PL_BS_FLAG, ag.GROUP_ID, head_status as Head_id, Head_name,
nvl(Details.GROUP_NATURE, ag.group_nature) as GROUP_NATURE,
nvl(Details.parent_id1, ag.parent_id1) as Parent_id1
from (
(SELECT SUM(nvl(MONTHBALANCEAMTDR, 0)) AS DR,
SUM(nvl(MONTHBALANCEAMTCR, 0)) AS CR,
SUM(nvl(OPBALANCEAMT, 0)) AS OPAMT, SUM(nvl(balance,
0)) AS balAmt, group_id, DTL.head_id,
DTL.head_status, DTL.head_name,
DTL.GROUP_NATURE, parent_id1
FROM ( SELECT SUM(nvl(MONTHBALANCEAMTDR, 0))
AS MONTHBALANCEAMTDR,
SUM(nvl(MONTHBALANCEAMTCR, 0))
AS MONTHBALANCEAMTCR, SUM(nvl(OPBALANCEAMT,
0)) AS OPBALANCEAMT, SUM(nvl(balance, 0))
AS balance, groupdetails.group_name,
groupdetails.group_id AS group_id,
groupdetails.head_id AS head_id,
GROUPDETAILS.HEAD_NAME,
groupdetails.head_status, PARENT_ID1,
ORDER_TO_PRINT, GROUP_NATURE
FROM (SELECT SUM(NVL(MONTHBALANCEAMTDR, 0)) AS MONTHBALANCEAMTDR,
SUM(NVL(MONTHBALANCEAMTCR, 0)) AS MONTHBALANCEAMTCR, head_id, HEAD_NAME,
group_ID, COMPANY_ID FROM (SELECT SUM(DECODE(DRCR, 0, (AMOUNT_IN_AED+nvl(CON_RATE_DIFF,0)),
0)) AS MONTHBALANCEAMTDR,
SUM(DECODE(DRCR, 1, (AMOUNT_IN_AED+nvl(CON_RATE_DIFF,0)), 0))
AS MONTHBALANCEAMTCR, AH.head_id,
AH.HEAD_NAME, AH.group_ID,
AH.COMPANY_ID
FROM federal.TRANS_DETAILS TD,
federal.account_heads AH
WHERE VOUCHER_DATE <= edate AND
VOUCHER_DATE >= sdate AND
AH.COMPANY_ID = TD.COMPANY_ID AND
AH.head_id = TD.head_iD AND
ah.company_id = companyid
GROUP BY DRCR, AH.group_id, AH.head_id,
AH.COMPANY_ID, AH.HEAD_NAME)
GROUP BY group_id, head_id, COMPANY_ID, HEAD_NAME )
transdetails,
(SELECT SUM(nvl((AMOUNT_IN_AED+nvl(CON_RATE_DIFF,0)), 0))
AS OPBALANCEAMT, AH.head_id,
AH.HEAD_NAME, AH.group_ID,
AH.COMPANY_ID
FROM federal.TRANS_DETAILS TD,
federal.account_heads AH
WHERE VOUCHER_DATE < sdate AND
AH.COMPANY_ID = TD.COMPANY_ID AND
AH.head_id = TD.head_iD AND
ah.company_id = companyid
GROUP BY AH.group_id, AH.head_id,
AH.COMPANY_ID, AH.HEAD_NAME)
OPENINGDETAILS,
( SELECT ah.head_id, DECODE(group_level, 1,
ah.head_id, 0) AS head_status,
0 AS BALANCE, accountgroup.company_id, accountgroup.group_id, parent_id2,
group_name, DECODE(group_level, 1, ah.head_name, ' ') AS head_name, ORDER_TO_PRINT,
GROUP_NATURE, parent_id1
FROM FEDERAL.account_heads AH,
(SELECT group_id, group_name, group_level, company_id, parent_id2, parent_id1,
ORDER_TO_PRINT, GROUP_NATURE
FROM FEDERAL.account_groups AG
WHERE AG.company_id = companyid and (GROUP_NATURE='I' or GROUP_NATURE='E' or GROUP_NATURE='P') )
accountgroup
WHERE AH.group_id = accountgroup.group_id AND
AH.company_id = accountgroup.company_id AND
AH.company_id = companyid) groupdetails
WHERE transdetails.head_id (+) = groupdetails.head_id AND
transdetails.company_id (+) = groupdetails.company_id AND
OPENINGdetails.head_id (+) = GROUPDETAILS.head_id AND
OPENINGdetails.company_id (+) = GROUPDETAILS.company_id
GROUP BY groupdetails.group_name, head_status,
groupdetails.group_id, groupdetails.head_id,
GROUPDETAILS.HEAD_NAME,
GROUPDETAILS.group_id, PARENT_ID2, head_status,
ORDER_TO_PRINT, GROUP_NATURE, parent_id1) DTL
GROUP BY group_id, DTL.head_id, DTL.head_name,
DTL.head_status, DTL.GROUP_NATURE, parent_id1)
UNION ALL
(SELECT DISTINCT
0, 0, 0, 0, accountgroup.group_id, 0 AS head_id,
0 AS head_status, ' ' AS head_name, GROUP_NATURE, parent_id1
FROM FEDERAL.account_heads AH,
(SELECT group_id, group_name, group_level, company_id,
parent_id1, ORDER_TO_PRINT, GROUP_NATURE
FROM FEDERAL.account_groups AG
WHERE AG.company_id = companyid and group_level<=2 and (GROUP_NATURE='I' or GROUP_NATURE='E' or GROUP_NATURE='P') ) accountgroup
WHERE AH.group_id = accountgroup.group_id AND
AH.company_id = accountgroup.company_id AND
AH.company_id = companyid AND
accountgroup.group_id = ah.group_id ) ) Details,
account_groups AG where Details.group_id (+) = AG.Group_id and AG.GROUP_LEVEL <=2 AND
ag.company_id = companyid group by
group_name, ORDER_TO_PRINT, GROUP_LEVEL, TR_PL_BS_FLAG, ag.GROUP_ID,
head_status, Head_name, Details.GROUP_NATURE, Details.parent_id1 , ag.GROUP_NATURE, ag.parent_id2, ag.parent_id1
order by parent_id1, GROUP_ID, ORDER_TO_PRINT, head_status, head_name ;
end pro_pandl_Exp1;
Thank you
Bosemonprakash wrote:
Hi all,
DECLARE
l_conn UTL_TCP.connection;
BEGIN
l_conn := ftp.login('Destination Ip address ', '22', 'Username', 'Password');
ftp.ascii(p_conn => l_conn);
ftp.put(p_conn => l_conn,
p_from_dir => 'MID5010_DOC1TEMP', -- Oracle Directory name from where we need to copy a file
p_from_file => 'Hipaa.33KM.5093.06152011130146885.834.O.irl',
p_to_file => '/qatest1/mihipaa5010/mj5010/DevelopmentStage/working_directory/Outbound/Data/75061252/Hipaa.00AN.07262011173844778.820.O.copied.irl'); -- Directory of the destination machine where we need to paste
ftp.logout(l_conn);
exception
when others then
dbms_output.put_line(sqlcode || sqlerrm);
--dbms_output.put_line(l_conn);
END;We are getting the below error:
SSH-1.99-OpenSSH_5.1
-29260ORA-29260: network error: TNS:connection closed
Could any one please let us know why this error is raising...As sybrand correctly points out, this issue doesn't belong here.
You are using a 3rd party package "ftp" and the error it is indicating suggests the issue is a network issue of some sort.
We don't have the code of that package or know what it is doing, so please consult whoever supplied or wrote the package and/or your network administrators. -
Stored Procedure Call from XMII
Hi, I am facing the following problem.
My SQL Stored Procedure has one input parameter,and it returns three values.
I want to know the syntax for calling this stored procedure ie. syntax in fixed query in XMII.
Thanks.Hi Adam,
I assume that you are using MSSQL server stored procedure which outputs 3 values.
Say that you are inputting 1 integer @inval and returning 3 integer values @outval1, @outval2, @outval3 from Stored Procedure
Then perform the following in Query Template
DECLARE @val1 INT
DECLARE @val2 INT
DECLARE @val3 INT
EXEC StoredProcedureName
@inval = 10,
@outval1 = @val1 OUTPUT,
@outval2 = @val2 OUTPUT,
@outval3 = @val3 OUTPUT
SELECT @val1,@val2,@val3
Use FixedQuery mode
Regards,
Adarsh
Edited by: Adarsh Sidnoor on Aug 27, 2009 7:46 PM
Edited by: Adarsh Sidnoor on Aug 27, 2009 7:47 PM -
Procedure call from SQL*Plus in Korn Shell Script
I am trying to excute a procedure from sqlplus, truncate_audit_table. I doesn't execute. If I do it manually
it executes. I have tried multiple ways, as below. This is inside a Korn Shell scripts that creates the procedure
and counts the aud$ table. All that works, but does not truncate the aud$ table. It does not do it, no error, just
passes it by. Does anybody know why?
${ORACLE_HOME}/bin/sqlplus -s / << EOF | tee -a ${LOG}
set feedback on
@/backup/oracle/orcl/audit/truncate_audit_table.sql
select count(*) from sys.aud$;
exec truncate_audit_table;
exit
EOF
${ORACLE_HOME}/bin/sqlplus -s / << EOF | tee -a ${LOG}
set feedback on
@/backup/oracle/orcl/audit/truncate_audit_table.sql
select count(*) from sys.aud$;
begin
truncate_audit_table;
end;
exit
EOF
This is the procedure that is being called:
create or replace procedure truncate_audit_table
as
begin
execute immediate 'truncate table sys.aud$';
end;
/aud$ is owned by sys. You can see it does the count with or without the "\".
It creates the procedure under SYS , but does not execute it.
Truncate aud$ table...
Procedure created.
COUNT(*)
422
1 row selected.
===============================================================
audit_maintenance.ksh Completed: Thu Oct 26 14:03:17 GMT 2006
=============================================================== -
How to get the debug sqlserver procedure calling from powerbuilder
How to get sqlserver debug while calling the procedure from PowerBuilder. Please can you help
Many Thanks
PolYou are better off doing this through the native SQL server tools. You can debug your PB code to find the variables being sent to the stored proc (if any) from PB and then use them in SQL Server Management Studio or similar.
-
Dbms_job.submit procedure called from Forms
Folks,
Since the DBMS_JOB.SUBMIT cannot be executed directly within a form, I created a simple procedure on the database which makes the call to DBMS_JOB.SUBMIT as follows:
FUNCTION web_newsletter_submit_job(p_letter_id NUMBER) RETURN NUMBER IS
v_jobnum NUMBER;
BEGIN
DBMS_JOB.SUBMIT (v_jobnum, 'send_mail_html2 (''DailyRacingForm<[email protected]>'', ''[email protected]'', ''DailyRacingForm<[email protected]>'', ''test subject'', ''test body'');',
TRUNC(SYSDATE) + 22/24);
RETURN v_jobnum;
END;
From SQL/Plus I can declare a varialbe and execute this procedure as follows:
v_jobnum := web_newsletter_submit_job(22) ;
then I can view the v_jobnum and find the job in the DBA_JOBS table.
My problem is when I execute the 'web_newsletter_submit_job' function from with Forms, my job never gets created. The function actually returns a job number and my Form display it via the Message() function; however, the job number never shows up in DBA_JOBS table.
Any ideas why I can successfully create the job from sql/plus but not from Forms ???
Regards,
Bobyou made a FORMS_DDL('COMMIT') right? without commiting, the jobe will never get executed.
Cheers, Stefan -
Stored Procedure calling from EJB
Can i call a stored procedure from a EJB. First time attempt.
IF some details available will help me a lotYou may just use JDBC to call a stored procedure from a BMP
bean. Below is a section from the "Oracle JDBC Developer's Guide
and Reference":
As an example of using Oracle syntax, here is a PL/SQL code
snippet that creates a stored function. The PL/SQL function gets
a character sequence and concatenates a suffix to it:
create or replace function foo (val1 char)
return char as
begin
return val1 || 'suffix';
end;
Your invocation call in your JDBC program should look like:
Connection conn = DriverManager.getConnection
("jdbc:oracle:oci8:@<hoststring>", "scott", "tiger");
CallableStatement cs = conn.prepareCall ("begin ? := foo(?);
end;");
cs.registerOutParameter(1,Types.CHAR);
cs.setString(2, "aa");
cs.executeUpdate();
String result = cs.getString(1);
Maybe you are looking for
-
Application Specific Popup in Web Dynpro - Issue
Hi Gurus, I am trying application specific popup which is described in FPM cook book. I am deferring the current event and trying the following steps as described in the cook book. 1) Created new WD ABAP view "POPUP_CARRIER" 2) In the component contr
-
see question
-
HT1849 how do i get track info to appear on car cd player
how do i get track info to appear on car cd player
-
ITunes when restoring ipad returns an error 40.
iTunes when restoring ipad returns an error 40. I'm not the only one facing the same problem. On this site you can find many examples. Device operated properly small period of time. The reason for the error flash nand. I think devices should be repla
-
ATE Engineer with LabVIEW Position Open
Moog Aircraft Group Salt Lake Operations has several immediate openings for Test Engineers with the following experience: 6+ years ATE experience, including real-time technologies, as applied to complex component simulation and control solutions. Wo