Procedure in Execute Immedite block
Hi, all.
I need to execute pl/sql procedure from Execute Immedite block.
I am trying to do it with exec but getting error:
begin
EXECUTE IMMEDIATE '
exec FillTestForOperation';
end;
begin
ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 2
Is there any way to do it?
JustasVred wrote:
Hi, all.
I need to execute pl/sql procedure from Execute Immedite block.
I am trying to do it with exec but getting error:
begin
EXECUTE IMMEDIATE '
exec FillTestForOperation';
end;
begin
ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 2
Is there any way to do it?Try :
declare
vstring varchar2(10);
begin
vstring := FillTestForOperation';';
execute immediate('begin '||vstring||' end;');
end;
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]
Similar Messages
-
Conditions in Guided Procedure to execute a block
hi All,
I am new to Guided Procedure,Please help.
My requirment is as follows-
There are multiple sequential block, before one final block i need to check a flag condition which comes from WebDynpro
If Yes i have to execute the block else dont execute the block
Kindly let know how to go ahead regarding this.
Thanks in advance.Hi Shikha,
Here is what you can do:
1.In your Web Dynpro application you can define two result-states : Say Passed and Failed. You will set one of these the result-states
based on your true-false logic. You'll have to create a Callable Object and an Action for this Web Dynpro app.
2.You have to place this action before your final block.
3.Create a 'Process Termination' callable object and and an action for that and place it after the Final Block.
4. Now for the two result-states for your action for the Web Dynpro Callable Object, assigne the targets :
e.g. Passed : <Name of the Final Block>
Failed : <Name of the 'Process Termination' Callable Object.
5. This way, when the Callable Object for Web Dynpro gets executed as part of the process, it will set the the result state either to Passed or to Failed based on the logic you have in your Web Dynpro.
And due to the target setting for those result-state, the Process will jump to your Final block(in case of 'Passed') or jump to the end callable object and terminate the process
Other option would be to, have a decision callable object before the Final Block, and have similar result-states for that callable Object which will be based on the output value of the parameter from (true/false) of your Web Dynpro callable object. Rest everything will work the same way.
Regards,
Ajay -
Stored Procedure Vs PL-SQL Block
Hi,
I came across an interesting problem last week. Fortunately, I was able to solve it or find an acceptable workaround for myself. But wanted to get some clarification from the experts. So posting it here.
Also, I am new to Orcle, so please excuse any shortcomings in the post.
My data model has following tables-
TABLE_PARENT (ID, other columns)
TABLE_CHILD (ID, other columns, PARENT_ID_FK)
Here, ID is the primary key column for the respective tables; PARENT_ID_FK is the foreign key referencing the ID column from the TABLE_PARENT.
I created a stored procedure programmatically (using MS Excel) to insert records in the two tables. The stored procedure has insert statements for an indefinite number of records in the parent table and for every such record, there's a corresponding record inserted in the child table. Here's the sample code.
BEGIN
/*first record*/
parent_id := MY_SEQUENCE_GENERATOR.NEXTVAL;
INSERT INTO TABLE_PARENT(ID, other columns) VALUES (parent_id, other values);
INSERT INTO TABLE_CHILD(ID, other values,parent_id );
/*second record*/
parent_id := MY_SEQUENCE_GENERATOR.NEXTVAL;
INSERT INTO TABLE_PARENT(ID, other columns) VALUES (parent_id, other values);
INSERT INTO TABLE_CHILD(ID, other values,parent_id );
/*third record*/
parent_id := MY_SEQUENCE_GENERATOR.NEXTVAL;
INSERT INTO TABLE_PARENT(ID, other columns) VALUES (parent_id, other values);
INSERT INTO TABLE_CHILD(ID, other values,parent_id );
/*and so on*/
END
When I run this stored procedure, I keep getting following exception intermittently-
ORA-02291: integrity constraint violated-parent key not found tips.
My thinking is that it comes because the insert statements are executing ahead of turn of the parent_id assignment statement. And this is happening possibly because of some parallelism that is taking place during the execution of the stored procedure, or, some sort of optmization that the DB server does (though erroneously) when it compiles the stored procedure.
I tried out everything that I could think of but it didn't go away. Finally, when I executed the same set of statements as a PL-SQL block, it worked fine.
To understand it better, I am looking for clarification on the following questions.
1) Why does the exception come with stored procedure but not with PL-SQL block? Is my reasoning given above correct (parallelism or some sort of optimization coming into play)?
2) If it is due to parallelism, how to run a Oracle stored procedure with defree of prallelism set to 1?
3) If it is due to optimization done by the compiler, how to instruct the compiler to not do any such optimization. Also, in any case, isn't it an error to optimize but lose program semantics?
4) Another question related to the same piece of work I have is to use transactions in the PL-SQL block, I had to explicitly COMMIT/ROLLBACK it in the code. In whatever references I had read, it was said that by default the transaction begins with BEGIN statement and commits with END. Also, it seems to work with a Stored Proedure though. So is it that a PL_SQL block needs explicity call to COMMIT/ROLLBACK to achive transactions but stored procedures do not?
Any inputs/clarifications will be much appreciated.
Thank you
NeeleshOk, your last couple of paragraphs were helpful. Here're the details that were missing in my earlier post.
- I am on Oracle 10.2.0.
- Table definitions-
CREATE TABLE "MYUSER"."TABLE_PARENT"
*( "ID" NUMBER(19,0) NOT NULL ENABLE,*
* "NAME" VARCHAR2(30),*
* "DESCRIPTION" VARCHAR2(80),*
* "RULETYPE" NUMBER(10,0) NOT NULL ENABLE,*
* "OPERATOR" NUMBER(10,0),*
* "MININTERCEPT" FLOAT(126),*
* "PRIORITY" NUMBER(10,0),*
* "PENALTY" NUMBER(10,0),*
* "STATUS" NUMBER(10,0),*
* PRIMARY KEY ("ID")*
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE,
*) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING*
STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
CREATE TABLE "MYUSER"."TABLE_CHILD"
*( "ID" NUMBER(19,0) NOT NULL ENABLE,*
* "WEIGHT" NUMBER(19,0),*
* "PARENTID_FK" NUMBER(19,0),*
* PRIMARY KEY ("ID")*
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE,
* CONSTRAINT "FK3A78BF1E6A9DCE51" FOREIGN KEY ("PARENTID_FK")*
* REFERENCES "MYUSER"."TABLE_PARENT" ("ID") ENABLE*
*) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING*
STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
- The Stored procedure definition is-
CREATE OR REPLACE PROCEDURE LOAD_RULES_SP AS
ruleid NUMBER(19,0);
tempid NUMBER(19,0);
BEGIN
*/* First parent record */*
SELECT IDGENERATOR.NEXTVAL INTO ruleid FROM dual;
INSERT INTO TABLE_PARENT (ID, NAME, DESCRIPTION, RULETYPE, OPERATOR, MININTERCEPT, PRIORITY, penalty, STATUS) VALUES (ruleid, 'Rule 1',null,3,0,0,null,null,1);
*/* Corresponding child records */*
SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
VALUES (tempid, 0.2, ruleid);
SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
VALUES (tempid, 0.5, ruleid);
SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
VALUES (tempid, 0.3, ruleid);
*/* First parent record */*
SELECT IDGENERATOR.NEXTVAL INTO ruleid FROM dual;
INSERT INTO TABLE_PARENT (ID, NAME, DESCRIPTION, RULETYPE, OPERATOR, MININTERCEPT, PRIORITY, penalty, STATUS) VALUES (ruleid, 'Rule 1',null,3,0,0,null,null,1);
*/* Corresponding child records */*
SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
VALUES (tempid, 0.2, ruleid);
SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
VALUES (tempid, 0.5, ruleid);
SELECT IDGENERATOR.NEXTVAL INTO tempid FROM dual;
INSERT INTO TABLE_CHILD (id, weight, PARENTID_FK)
VALUES (tempid, 0.3, ruleid);
*/* And so on for a few parent records more */*
END;
Can you throw some light on the exception I was seeing now? Note that when I changed from stored procedure to an anonymous block, it worked fine.
One correction in my earlier post is that as the code snippet shows, there are multiple inserts in the child table for every record inserted in the parent one. -
Can a flag field be used in a procedure to determine prior block success
I have a below stored procedure that has a IN and OUT parameter. The block
has structure as below.
In this procedure there are multiple inner blocks each with an individual
exception handler. I need to modify this to pass a flag field as a additional parameter
to this procedure such that should any of the inner block execution were to fail, the next execution should pass the control to the failed block (as in the previous successfully executed INNER blocks should not be re-executed).
How can I acheive this?
CREATE OR REPLACE PROCEDURE procname(some_in_variable IN datatype1,
some_out_variable OUT datatype2)IS
var1 datatype;
var2 datatype;
cursor cursorname IS
BEGIN
IF some_condition then
RAISE main_exception_encountered
ELSE
DECLARE -- BEGIN OF INNER BLOCK 1
BEGIN
IF CONDITION THEN
ELSE
raise some_excep;
END IF;
END; -- END OF INNER BLOCK 1
DECLARE -- BEGIN OF INNER BLOCK 2
BEGIN
SELECT statements here
exec some_procedure_name(param1, param2);
exception
END; -- BEGIN OF INNER BLOCK 2
EXCEPTION
when some_excep then.....
EXCEPTION
when main_exception_encountered...do something
END procname;steve2312 wrote:
Ok. I plan on use the below code snippet inside every block prior to an exception being raised. This will set flag value to N when a block fails.
UPDATE processlogtable
SET flagfield = 'N'
WHERE pk_field = 'somevalue';
COMMIT;The next time a new block is read it'll check for the flag, if it is Y then the block is executed. However, if the flag is N due to a failed block how can I make the procedure go back to that failed block?Do you really want to COMMIT all DML changes that caused an EXCEPTION? -
Dear buddies,
I have a few lines of code which looks like this.
declare
t_Count number := 0;
t_CommitPoint number := 100;
t_ObjectDefID number;
t_ObjectID number;
cursor c_Trees is
select Treeid,
Treetype,
decode(upper(Continent),'AF','Africa',
'AN','Antarctica',
'AS','Asia',
'AU','Australia',
'EU','Europe',
'NA','North America',
'SA','South America',
'Unknown') Continent,
Climate
from conversion.v_Trees;
begin
t_ObjectDefID := api.pkg_ObjectDefQuery.IdForName('Trees');
api.pkg_LogicalTransactionUpdate.ResetTransaction();
api.pkg_LogicalTransactionUpdate.StartTransaction();
.ORA-06550: line 23, column 18:
PLS-00201: identifier 'API.PKG_OBJECTDEFQUERY' must be declared
and a few errors like this.
How should I declare this api?
How should I execute this block? Please guide me.
Thanking in advance.
Nith
Edited by: user645399 on Aug 13, 2010 3:18 PMHow are you using API package in pl/sql block then?
Check whether it exists or not??
As per the error, API package must exist in the schema but not in the Declare section..........syntax for creating objects does not require DECLARE section !!
Declare the API package in schema. and compile again.....if any issue comes, paste your procedure code here. -
Java Stored Procedure in EXECUTE IMMEDIATE
Hi,
I need advice for the following.
I'm on Oracle 11g R2. I'm testing application in Oracle 11gR1 and R2 and Oracle Express.
Purpose is to generate XML reports.
I have PLSQL Stored Procedure which does that, but since there is bug in Oracle11gR2 related to XMLTRANSFORM I have and Java Stored Procedure which is workaround. They are both compiled, valid etc.
Java class is :
import java.io.PrintWriter;
import java.io.Writer;
import oracle.xml.parser.v2.DOMParser;
import oracle.xml.parser.v2.XMLDocument;
import oracle.xml.parser.v2.XSLProcessor;
import oracle.xml.parser.v2.XSLStylesheet;
* This class is used as Java stored procedure
* There is a bug on Oracle11gR2, related to the limitation on the number of style sheet instructions
* This stored procedure is workaround when PLSQL code can not be used.
* File must not have package, otherwise is wrongly compiled in DB
public class JavaXslt {
public static void XMLTtransform(oracle.sql.CLOB xmlInput,oracle.sql.CLOB xslInput,oracle.sql.CLOB output) throws Exception{
DOMParser parser;
XMLDocument xml;
XMLDocument xsldoc;
try{
parser = new DOMParser();
parser.parse(xmlInput.getCharacterStream());
xml = parser.getDocument();
parser.parse(xslInput.getCharacterStream());
xsldoc = parser.getDocument();
XSLProcessor processor = new XSLProcessor();
XSLStylesheet xsl = processor.newXSLStylesheet(xsldoc);
Writer w = output.setCharacterStream(1L);
PrintWriter pw = new PrintWriter(w);
processor.processXSL(xsl, xml, pw);
}catch (Exception ex){
throw ex;
PROCEDURE Java_XmlTransform (xml CLOB, xslt CLOB, output CLOB) AS LANGUAGE JAVA
NAME 'JavaXslt.XMLTtransform(oracle.sql.CLOB, oracle.sql.CLOB, oracle.sql.CLOB)';
I'm calling Java stored procedure from PLSQL Stored procedure (if it is Oracle11gR2) like that :
Java_Proc.Java_XmlTransform(inputXML, xslt, res);
So till here everything works ok. XSLT as applied and output XML (res) is OK.
But when Oracle Express is used Java is out of the question, so there is no Java stored procedure. Howewer PLSQL Stored procedure is still needed.
So I had to put call to Java Stored procedure in EXECUTE IMMEDIATE statement in order to compile to PLSQL package.
But when I do that :
EXECUTE IMMEDIATE 'BEGIN Java_Proc.Java_XmlTransform (:1, :2, :3); END;' USING inputXML, xslt, res;
result value CLOB (res) has zero length...
What am I missing? Should i set return value to Java class?
Hope my explanations are clear though.
ThanksHi odie_63,
Thanks for quick response.
I didn't clearly explained.
When using Oracle 11gR1 and Oracle Express I'm using only PLSQL Procedure.
When using Oracle 11gR2 i have to use Java Stored procedure because there is documented bug in R2.
That's why i have to use EXECUTE IMMEDIATE. I don't know which version is the client DB and whether there is or no Java procedures.
I did tried
EXECUTE IMMEDIATE 'BEGIN Java_Proc.Java_XmlTransform (:1, :2, :3); END;' USING IN inputXML, IN xslt, OUT res; and the result was ORA-06537: OUT bind variable bound to an IN position
When using IN OUT for last parameter i.e.
EXECUTE IMMEDIATE 'BEGIN Java_Proc.Java_XmlTransform (:1, :2, :3); END;' USING IN inputXML, IN xslt, IN OUT res;
there is no exception, but still DBMS_LOB.getlength(res) = 0
Thanks -
Hi,
I have a report which is calling a stored procedure..
Stored procedure exceutes 4-5 stored procedure and then returns the count each procedure it ran using union all statement... The stored procedure takes around 3-4 hrs to run because it is looking at quarterly data and YTD data.
So once the report is kicked off and the procedure behind it runs and runs how will communicate to the report to show the final data... the final data will just be 5 rows with counts.
I think we are running into a issue where the stored procedure runs and runs and then the report goes into la la land and has no clue what to do...
Can you please shed some light on this..
Thanks
KarenHi Karen,
When we render a report, the report would process the following procedures:
Open connections to data source and reading data rows from data extensions for all datasets, means retrieve data. Then process the engine requests, including the tablix, grouping, sorting, filtering, aggregations and subreport processing, means process report.
Finally, render the report, including the pagination modules and on-demand expression evaluations.
So the report rending has to wait until the stored procedure is executed. To improve the performance, we can consider the three aspects:
Improve the performance of the stored procedures. Such as index and join. For better support, I suggest you can post a new thread about this issue in Transact-SQL forum at:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=transactsql. It is appropriate and more experts will assist you.
Simplify the report. For example, avoid including a reference to [&TotalPages] or any complex expressions in the page header and page footer. For more details, please see the following document:
http://technet.microsoft.com/en-us/library/bb522806(v=sql.105).aspx
Using cashing if you have a long-running query that cannot be tuned further. For more details, please refer to the following article:
http://msdn.microsoft.com/en-us/library/ms159241(v=sql.110).aspx
Hope this helps.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Need to refresh materialized view from procedure and pl/sql block
Hi,
I need to refresh materialized view (complete refresh)from procedure and pl/sql block .can some one help.
MV name:MV_DGN_TEST_SESSION
Thanks,
Rajasekhardbms_mview.REFRESH ('MV_DGN_TEST_SESSION', 'C');Regards,
Mahesh Kaila
Edited by: user4211491 on Dec 1, 2009 10:41 PM -
How do I merge data from table1 on server 1 to final table on server 2 with a stored procedure to execute every so
many hours.How big is the table on server B? Is that possible to bring the all data into a server A and merge the data locally?
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How do I merge data from table1 on server 1 to final table on server 2 with a stored procedure to execute every so many hours.
Hello,
If you had configure server2 as
linked server on the server1, you can run the following statement inside stored proceduce to copy table data. And then create a job to the run stored proceduce every 4 hours.
Insert Into Server2.Database2.dbo.Table2
(Cols)
Select Cols From Server1.Database1.dbo.Table1
Or you can use the SQL Server Import and Export Wizard to export the data from server1 to server2, save the SSIS package created by the wizard on the SQL Server, create a job to run the SSIS package.
Reference:http://technet.microsoft.com/en-us/library/ms141209.aspx
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
How to execute each block in a multi-block canvas while select the tab?
Hi All,
How to execute each block in a multi-block canvas by selecting a tab? I mean to say when i select a particular tab in a tab canvas the records should execute.How can i set this?
ArifHi Arif
Good Example Manu offered i wish it works if not pls try the following...
Pls try in the when-tab-page-changed trigger in the form level
DECLARE
tp_name varchar2(30);
BEGIN
-- Retrieve the NAME of the top most tab page using the built-in GET_CANVAS_PROPERTY function.
--Pass in the name of the Canvas your tabs are in and the system variable topmost_tab_page which stores a property number
tp_name := GET_CANVAS_PROPERTY('CANVAS11',topmost_tab_page);
-- Perform specific tasks based on the name of the top most tab
IF tp_name = 'PAGE12' then
GO_BLOCK('block_name');
GO_ITEM('DATA_BLOCK_1.FIELD_1');
EXECUTE_QUERY;
ELSIF tp_name = 'PAGE38' then
GO_BLOCK('block_name');
GO_ITEM('DATA_BLOCK_2.FIELD_1');
EXECUTE_QUERY;
ELSIF tp_name = 'PAGE47' then
GO_BLOCK('block_name');
GO_ITEM('DATA_BLOCK_3.FIELD_1');
EXECUTE_QUERY;
END IF;
END;
Hope it helps...
Note: i do agree with Craig
Regards,
Abdetu...
Edited by: Abdetu on Feb 2, 2011 7:41 AM -
Finding Stored Procedure(s) Executed
Hi,
I need to find which stored procedure got executed when I run my application.
My application is in .NET and I am using Oracle 9.2.0.5
Thanks in advance.
Pravin PawarYou can use SQL trace and TKPROF for that.
1. Creation of PL/SQL and execution of procedures:
bas002>
bas002>
bas002> create or replace procedure p2
2 is
3 d date;
4 begin
5 select sysdate into d from dual;
6 end;
7 /
Procedure created.
bas002> show errors
No errors.
bas002>
bas002> create or replace procedure p1
2 is
3 n number;
4 begin
5 p2;
6 select count(*) into n from dual;
7 end;
8 /
Procedure created.
bas002> show errors
No errors.
bas002>
bas002> create or replace procedure p0
2 is
3 begin
4 null;
5 end;
6 /
Procedure created.
bas002> show errors
No errors.
bas002>
bas002>
bas002> alter session set sql_trace=true;
Session altered.
bas002>
bas002> exec p1;
PL/SQL procedure successfully completed.
bas002>
bas002> exec p0;
PL/SQL procedure successfully completed.
bas002>
bas002> alter session set sql_trace=false;
Session altered.2. use TKPROF to get formated trace file:
tkprof bas002_ora_892.trc output=test.trctest.trc contains:
TKPROF: Release 10.2.0.2.0 - Production on Wed Jan 30 15:03:54 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Trace file: bas002_ora_892.trc
Sort options: default
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
alter session set sql_trace=true
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 1 0.00 0.00 0 0 0 0
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 55
BEGIN p1; END;
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.03 0.03 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.03 0.03 0 0 0 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 55
SELECT SYSDATE
FROM
DUAL
call count cpu elapsed disk query current rows
Parse 1 0.00 0.01 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 0 0 1
total 3 0.00 0.02 0 0 0 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 55 (recursive depth: 1)
SELECT COUNT(*)
FROM
DUAL
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 0 0 1
total 3 0.00 0.00 0 0 0 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 55 (recursive depth: 1)
BEGIN p0; END;
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 0 1
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 55
alter session set sql_trace=false
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 0 0
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 55
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 3 0.00 0.00 0 0 0 0
Execute 4 0.03 0.03 0 0 0 2
Fetch 0 0.00 0.00 0 0 0 0
total 7 0.03 0.03 0 0 0 2
Misses in library cache during parse: 1
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 2 0.00 0.01 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.00 0 0 0 2
total 6 0.00 0.02 0 0 0 2
Misses in library cache during parse: 2
6 user SQL statements in session.
0 internal SQL statements in session.
6 SQL statements in session.
Trace file: bas002_ora_892.trc
Trace file compatibility: 10.01.00
Sort options: default
1 session in tracefile.
6 user SQL statements in trace file.
0 internal SQL statements in trace file.
6 SQL statements in trace file.
6 unique SQL statements in trace file.
60 lines in trace file.
0 elapsed seconds in trace file.I don't know if it's possible to get with TKPROF all procedures called by top level procedures (in this example p2 call is missing).
I made this test with 10.2.0.2 but it should work the same for 9.2.0.5.
Message was edited by:
Pierre Forstmann -
How pass date parametet in procedure while executing
I am written procerdure in which I have to pass parameter the datatype is date how can I am able to pass the date while executing
please help meya its from the cient application but I am checking that procedure is executing properly or not so I passing it through prompt.
I am executing in tha same format given by u, its displaying following error
BEGIN HANGER_FAILURE_PROCEDURE (to_date('01-jan-05','dd-mon-yy') ); END;
ERROR at line 1:
ORA-01001: invalid cursor
ORA-06512: at "SYSTEM.HANGER_FAILURE_PROCEDURE", line 62
ORA-06512: at line 1
===============================
And my procedure is
CREATE OR REPLACE PROCEDURE HANGER_FAILURE_PROCEDURE (startDate IN FRIT_HANGER.AGING_START_TIME%TYPE ) IS
shiftDescription SHIFT.DESCRIPTION%TYPE;
failure_number HANGER_FAILURE.FAILURE_NUMBER%TYPE;
failure HANGER_FAILURE.FAILURE_NUMBER%TYPE;
fritID LVT_TEST.FRIT_ID%TYPE ;
lvt_description LVT.DESCRIPTION%TYPE;
test_time LVT_TEST.TEST_TIME%TYPE ;
mikr LVT_TEST.MIKR%TYPE;
mikr_res LVT_TEST.MIKR_PASSED%TYPE;
mikg LVT_TEST.MIKG%TYPE;
mikg_res LVT_TEST.MIKG_PASSED%TYPE;
mikb LVT_TEST.MIKB%TYPE;
mikb_res LVT_TEST.MIKB_PASSED%TYPE;
coe2r LVT_TEST.COE2R%TYPE;
coe2r_res LVT_TEST.COE2R_PASSED%TYPE;
coe2g LVT_TEST.COE2G%TYPE;
coe2g_res LVT_TEST.COE2G_PASSED%TYPE;
coe2b LVT_TEST.COE2B%TYPE;
coe2b_res LVT_TEST.COE2B_PASSED%TYPE;
grparameter AGING_TEST.GR%TYPE;
ccr VTS_TEST.CCR%TYPE;
ccg VTS_TEST.CCG%TYPE;
ccb VTS_TEST.CCB%TYPE;
aging_hangerId AGING_HANGER.AGING_HANGER_ID%TYPE;
aging_start_time FRIT_HANGER.AGING_START_TIME%TYPE;
failure_type HANGER_FAILURE_TYPE.HANGER_FAILURE_TYPE_ID%TYPE;
CURSOR result_lvt(sdate FRIT_HANGER.AGING_START_TIME%TYPE) IS
SELECT
AGING_HANGER.AGING_HANGER_ID,
LVT.DESCRIPTION,
FRIT_HANGER.AGING_START_TIME,
LVT_TEST.FRIT_ID,
LVT_TEST.TEST_TIME,
LVT_TEST.MIKR,
LVT_TEST.MIKR_PASSED,
LVT_TEST.MIKG,
LVT_TEST.MIKG_PASSED,
LVT_TEST.MIKB,
LVT_TEST.MIKB_PASSED,
LVT_TEST.COE2R,
LVT_TEST.COE2R_PASSED,
LVT_TEST.COE2G,
LVT_TEST.COE2G_PASSED,
LVT_TEST.COE2B,
LVT_TEST.COE2B_PASSED
FROM LVT_TEST,LVT,FRIT_HANGER,AGING_HANGER
WHERE LVT_TEST.LVT_ID=LVT.LVT_ID
AND
FRIT_HANGER.AGING_HANGER_ID=AGING_HANGER.AGING_HANGER_ID
AND LVT_TEST.FRIT_ID=FRIT_HANGER.FRIT_ID
AND FRIT_HANGER.AGING_START_TIME>sdate
ORDER BY FRIT_HANGER.AGING_START_TIME;
BEGIN
IF result_lvt%ISOPEN THEN
OPEN result_lvt(startDate);
END IF;
LOOP
FETCH result_lvt
INTO aging_hangerId, lvt_description, aging_start_time, fritID, test_time, mikr, mikr_res, mikg, mikg_res, mikb, mikb_res, coe2r, coe2r_res, coe2g, coe2g_res, coe2b, coe2b_res;
exit when result_lvt%NOTFOUND;
SELECT GR INTO grparameter
FROM AGING_TEST
WHERE
TEST_TIME = (SELECT MAX(TEST_TIME) FROM AGING_TEST WHERE FRIT_ID = fritID);
SELECT CCR, CCG, CCB INTO ccr,ccg,ccb
FROM VTS_TEST
WHERE TEST_TIME = (SELECT MAX(TEST_TIME) FROM VTS_TEST WHERE FRIT_ID = fritID);
SELECT DESCRIPTION INTO shiftDescription
FROM SHIFT
WHERE START_TIME=TRUNC( aging_start_time);
IF( mikr_res=0 OR mikg_res = 0 OR mikb_res = 0 )
THEN
SELECT MAX(FAILURE_NUMBER) INTO failure
FROM HANGER_FAILURE
WHERE AGING_HANGER_ID=aging_hangerId
AND TO_DATE(AGING_START_TIME) = TO_DATE(aging_start_time)
AND
SHIFT_DESCRIPTION = shiftDescription;
failure_number:=failure+1;
SELECT HANGER_FAILURE_TYPE_ID INTO failure_type
FROM HANGER_FAILURE_TYPE
WHERE DESCRIPTION='MIK';
INSERT INTO HANGER_FAILURE (HANGER_FAILURE_ID, HANGER_FAILURE_TYPE_ID, AGING_HANGER_ID,
SHIFT_DESCRIPTION, AGING_START_TIME, FAILURE_NUMBER, LVT_DESCRIPTION,FRIT_ID,TEST_TIME, MIKR, MIKG, MIKB, COE2R, COE2G, COE2B, GR,CCR, CCG ,CCB ) VALUES(HANGER_FAILURE_ID_GENERATOR.NEXTVAL, failure_type, aging_hangerId, shiftDescription,aging_start_time,failure_number ,lvt_description, fritID,test_time, mikr,mikg,mikb,coe2r,coe2g,coe2b,grparameter,ccr,ccg,ccb);
ELSE
DBMS_OUTPUT.PUT_LINE('Doesn''t occur any MIK failure');
END IF;
IF (coe2r_res = 0 OR coe2g_res = 0 OR coe2b_res = 0)
THEN
SELECT MAX(FAILURE_NUMBER) INTO failure
FROM HANGER_FAILURE
WHERE AGING_HANGER_ID=aging_hangerId
AND TO_DATE(AGING_START_TIME) = TO_DATE(aging_start_time)
AND
SHIFT_DESCRIPTION = shiftDescription;
failure_number :=failure+1;
SELECT HANGER_FAILURE_TYPE_ID INTO failure_type
FROM HANGER_FAILURE_TYPE
WHERE DESCRIPTION='COE2';
INSERT INTO HANGER_FAILURE (HANGER_FAILURE_ID,HANGER_FAILURE_TYPE_ID,AGING_HANGER_ID,
SHIFT_DESCRIPTION,AGING_START_TIME ,FAILURE_NUMBER, LVT_DESCRIPTION,FRIT_ID,TEST_TIME,MIKR,MIKG,MIKB,COE2R,COE2G,
COE2B,GR ,CCR,CCG ,CCB ) VALUES(HANGER_FAILURE_ID_GENERATOR.NEXTVAL, failure_type, aging_hangerId, shiftDescription,aging_start_time,failure_number ,lvt_description, fritID,test_time, mikr,mikg,mikb,coe2r,coe2g,coe2b,grparameter,ccr,ccg,ccb);
ELSE
DBMS_OUTPUT.PUT_LINE('Doesn''t occur any COE2 failure');
END IF;
END LOOP;
CLOSE result_lvt;
END;
plz help me -
Stored Procedure killed the root blocker in rac 10g
Hi every one,
I need the procedure that killed root blocker in RAC environmental 10g,
I found the stored procedure for 11g which simple but 10g required some expertise
because I want to just exec [procedure] it will kill root blocker either locally and remote node
thanks a lot
Edited by: user11688837 on Jan 30, 2013 10:08 AMI Checked your link as for regarding 11g RAC its find. But for the regarding 10g it will never work on
remote node you have to used only and only dbms_job.sumbit to kill remote node.
your kind information please rectify the commend that it will work on local node not on remote node in 10g
'ALTER SYSTEM KILL SESSION '||a.sid||','||a.serial#||''' IMMEDIATE;' as "10g Command to kill session",
thankyou
Edited by: user11688837 on Jan 30, 2013 10:06 AM
Edited by: user11688837 on Jan 30, 2013 10:26 PM -
How to get name of PL/SQL stored procedure being executed?
When executing a PL/SQL stored procedure, is there a way to extract the name of the procedure programatically?
(Similar to the way an Oracle Form can retrieve it's own name via GET_APPLICATION_PROPERTY(CURRENT_FORM_NAME). )
ThanksHere is one sample ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.17
satyaki>
satyaki>
satyaki>CREATE OR REPLACE PROCEDURE error_test1 AS
2 BEGIN
3 dbms_output.put_line(dbms_utility.format_call_stack);
4 END error_test1;
5 /
Procedure created.
Elapsed: 00:00:06.45
satyaki>
satyaki>
satyaki>exec error_test1;
----- PL/SQL Call Stack -----
object line object
handle number name
1D609C14 3 procedure SCOTT.ERROR_TEST1
1D5A89B8 1 anonymous block
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.21
satyaki>
satyaki>Regards.
Satyaki De.
Maybe you are looking for
-
When trying to open a PDF in Photoshop Crashes
I had a PDF > > When I am trying to open the PDF in CS2 or CS3 Photoshop Crashes. > Can you tell what is wrong here > > I work on Mac 10.5.8 > Photoshop CS3 10.0.1 > > Excerpt from PDF file > > %PDF-1.6 <xap:CreateDate>2009-02-12T08:26:29+06:00</xap:
-
Yet another problem; iPod not recognized in windows after uninstall
So I'm still trying to fix my faulty iPod and now, after Apple telling me to uninstall and re-install the USB software, it is not recognized, when I plug my iPod in it comes up "installing software" then asks for a disk, thing is I was not given a di
-
Help please! Resume isn't going from .pages to .doc
My resume is exactly how I'd like it to look in .pages format but I've tried EVERYTHING to change it to a .doc document because a lot of employers are asking for resumes and cover letters in a word (.doc) format ONLY. Of course I can save it as a pdf
-
Where to buy 17" studio display
does anyone have any ideas to where i can buy an Apple 17" LCD studio display besides ebay? Mac OS X (10.3.9) power mac G4 (MDD), 2-power mac G4 (AGP), G3 ibook, mac mini
-
Shorten environment variable path
I am installing Oracle database 10G on Windows XP. I am getting an error message saying 'The value of the environment variable path is more than 1023 characters.' How do I shorten this path, where do I go? thanks