How to use OUT variables in my stored procedure
I'm wondering if I can get some help using OUT variables in my stored procedure. Here's my code...
CREATE OR REPLACE PROCEDURE testProj.testProcedure (
v_segment_id IN VARCHAR2,
v_student_id OUT VARCHAR2,
v_current_code OUT NUMBER,
v_new_code OUT NUMBER
) AS
BEGIN
SELECT
s.student_id,
s.quad_code_id,
nc.quad_code_id
INTO
v_student_id,
v_current_quad_code,
v_new_quad_code
FROM testProj.students s
INNER JOIN testProj.new_codes nc ON s.student_id = nc.student_id
WHERE s.segment_id = v_segment_id ;
END testProcedure ;
EXECUTE testProj.testProcedure ('44') ;
When I execute that stored procedure with the above execute statement, I get this error:
Error report:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'testProcedure'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
+06550. 00000 - "line %s, column %s:\n%s"+
*Cause: Usually a PL/SQL compilation error.+
*Action:+
Using Refcursor is one way you can do that ->
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.21
satyaki>
satyaki>
satyaki>create or replace procedure r_arg(
2 choice in number,
3 b in out sys_refcursor
4 )
5 is
6 str varchar2(500);
7 begin
8 str := 'select * from emp';
9 open b for str;
10 exception
11 when others then
12 dbms_output.put_line(sqlerrm);
13 end;
14 /
Procedure created.
Elapsed: 00:00:01.84
satyaki>
satyaki>
satyaki>declare
2 rec_x emp%rowtype;
3 w sys_refcursor;
4 begin
5 dbms_output.enable(1000000);
6 r_arg(1,w);
7 loop
8 fetch w into rec_x;
9 exit when w%notfound;
10 dbms_output.put_line('Employee No: '||rec_x.empno||' - '||
11 'Name: '||rec_x.ename||' - '||
12 'Job: '||rec_x.job||' - '||
13 'Manager: '||rec_x.mgr||' - '||
14 'Joining Date: '||rec_x.hiredate||' - '||
15 'Salary: '||rec_x.sal||' - '||
16 'Commission: '||rec_x.comm||' - '||
17 'Department No: '||rec_x.deptno);
18 end loop;
19 close w;
20 exception
21 when others then
22 dbms_output.put_line(sqlerrm);
23 end;
24 /
Employee No: 9999 - Name: SATYAKI - Job: SLS - Manager: 7698 - Joining Date: 02-NOV-08 - Salary: 55000 - Commission: 3455 - Department No: 10
Employee No: 7777 - Name: SOURAV - Job: SLS - Manager: - Joining Date: 14-SEP-08 - Salary: 45000 - Commission: 3400 - Department No: 10
Employee No: 7521 - Name: WARD - Job: SALESMAN - Manager: 7698 - Joining Date: 22-FEB-81 - Salary: 1250 - Commission: 500 - Department No: 30
Employee No: 7566 - Name: JONES - Job: MANAGER - Manager: 7839 - Joining Date: 02-APR-81 - Salary: 2975 - Commission: - Department No: 20
Employee No: 7654 - Name: MARTIN - Job: SALESMAN - Manager: 7698 - Joining Date: 28-SEP-81 - Salary: 1250 - Commission: 1400 - Department No: 30
Employee No: 7698 - Name: BLAKE - Job: MANAGER - Manager: 7839 - Joining Date: 01-MAY-81 - Salary: 2850 - Commission: - Department No: 30
Employee No: 7782 - Name: CLARK - Job: MANAGER - Manager: 7839 - Joining Date: 09-JUN-81 - Salary: 4450 - Commission: - Department No: 10
Employee No: 7788 - Name: SCOTT - Job: ANALYST - Manager: 7566 - Joining Date: 19-APR-87 - Salary: 3000 - Commission: - Department No: 20
Employee No: 7839 - Name: KING - Job: PRESIDENT - Manager: - Joining Date: 17-NOV-81 - Salary: 7000 - Commission: - Department No: 10
Employee No: 7844 - Name: TURNER - Job: SALESMAN - Manager: 7698 - Joining Date: 08-SEP-81 - Salary: 1500 - Commission: 0 - Department No: 30
Employee No: 7876 - Name: ADAMS - Job: CLERK - Manager: 7788 - Joining Date: 23-MAY-87 - Salary: 1100 - Commission: - Department No: 20
Employee No: 7900 - Name: JAMES - Job: CLERK - Manager: 7698 - Joining Date: 03-DEC-81 - Salary: 950 - Commission: - Department No: 30
Employee No: 7902 - Name: FORD - Job: ANALYST - Manager: 7566 - Joining Date: 03-DEC-81 - Salary: 3000 - Commission: - Department No: 20
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.48
satyaki>
satyaki>Regards.
Satyaki De.
Similar Messages
-
Printing OUT variables from a Stored Procedure
Hi all,
I'm running an SQL command that calls a Stored Procedure and passes in some value. I've pasted in the important parts of it below. What I am trying to do is access the OUT variables that have been assigned to the DECLARED variables. I come from a SQL Server background and there we can do "SELECT @variable" which will print it to screen. I'm trying to do something similar here.
I need to access the contents of the three variables declared at the top of the script.
Thanks in advance.
DECLARE
l_error_value NUMBER;
l_error_product VARCHAR2 (10);
l_CE_DOC_ID number;
BEGIN
PEM.create_enquiry
( ce_cat => 'COMP'
, ce_class => 'FRML'
, error_value => l_ERROR_VALUE
,error_product => l_ERROR_PRODUCT
, ce_doc_id => l_ce_doc_id
END;Ah yes I see. Sorry I misunderstood what you were suggesting. I'm currently working on a test script that uses an approach similar to the one you mentioned, but I'm having trouble resolving foreign key relationships with test data.
I've no access to the tables or anything so it's proving to be a time consuming task!!
Is it required that all fields are given a value, even if they have a "DEFAULT" defined for them within the procedure. At the moment I'm using a rather cumbersome approach to this:
i.e.
With cmmAddRequest
.ActiveConnection = strConnect
.CommandType = adCmdText
.CommandText = strSQL
.Parameters(0).Direction = adParamInput
.Parameters(1).Direction = adParamInput
.Parameters(2).Direction = adParamInput
.Parameters(3).Direction = adParamOutput
.Parameters(4).Direction = adParamOutput
.Parameters(5).Direction = adParamOutput
.Parameters(0).Value = "COMP"
.Parameters(1).Value = "FRML"
.Parameters(2).Value = "1"
.Execute
WScript.Echo(.Parameters(5).Value)
End With -
How to pass javascript variable to PLSQL stored procedure
Hi,
How can I pass a javascript variable to a database procedure. I have a form with a radio button group and would like to save the value of the selected radio button to a database table by passing the value to the stored procedure.
ThanksHi
You can use iframe to call the procedure. Here is an example used in dynamic page or pl/sql portlet. The pl/sql procedure is called myprocedure and resists in the schema myschema. This example passes 2 parameters, but I have not yet reased a limit.
First the call within a javascript function:
myiframe.location.href="myschema.myprocedure?p_myprameter1=" + vJvascriptparameter1 + "&p_myprameter2=" + vJvascriptparameter2;
Then the iframe:
<iframe id="myiframe" height="0" width="0" frameborder="0"></iframe>
You can let the pl/sql procedure print a value, that can be used i the portlet. You can get the value in a javascript this way:
myvalue=top.window.frames["myiframe"].document.body.innerHTML;
Best regards
Klaus -
How to use a parameter passed to stored procedure in cursor?
I am rather new to Oracle stored procedures and I'm sure that
this is rather simple. Could someone tell me how to do the
following: I would like to pass the variable status into my
stored procedure and then use it in the where clause when
defining my cursor. I have the stored procedure working 100%
other than this small detail.
CREATE OR REPLACE PROCEDURE p_report_starwood_exhibita2(hno
VARCHAR2, cid INTEGER, kperiod INTEGER, status VARCHAR2, user
VARCHAR2) IS
BEGIN
DECLARE
CURSOR bid_cursor IS
SELECT bm.hotelid
FROM dbo.bidmaster bm
WHERE bm.channelid = cid
and bm.contractperiod = kperiod
and bm.bidstatus like '&status'
END;
Thank youI am rather new to Oracle stored procedures and I'm sure that
this is rather simple. Could someone tell me how to do the
following: I would like to pass the variable status into my
stored procedure and then use it in the where clause when
defining my cursor. I have the stored procedure working 100%
other than this small detail.
CREATE OR REPLACE PROCEDURE p_report_starwood_exhibita2(hno
VARCHAR2, cid INTEGER, kperiod INTEGER, status VARCHAR2, user
VARCHAR2) IS
BEGIN
DECLARE
CURSOR bid_cursor IS
SELECT bm.hotelid
FROM dbo.bidmaster bm
WHERE bm.channelid = cid
and bm.contractperiod = kperiod
and bm.bidstatus like '&status'
END;
Thank you You can do something like this
CREATE OR REPLACE PROCEDURE p_report_starwood_exhibita2(hno
VARCHAR2, cid INTEGER, kperiod INTEGER, status VARCHAR2, user
VARCHAR2) IS
BEGIN
DECLARE
CURSOR bid_cursor (p_status varchar2) IS
SELECT bm.hotelid
FROM dbo.bidmaster bm
WHERE bm.channelid = cid
and bm.contractperiod = kperiod
and bm.bidstatus like p_status
END;
and then in the BEGIN section do
open bid_cursor(status)
This should work.
Regards
Manoj -
How to find out names of all stored procedures?
Hi All,
I need to find out the names of all stored procedures with parameters and return types. I can use DBA_SOURCE, but in this case I must parse TEXT to find out what I need. Is there any dictionary where the names, parameters and return types of stored procedures saved separately?
Thanks,
Andrej.Not much fair to bring this old post up, sorry!
I am still looking for an answer to my post
where are stored functions like ORA_HASH or GROUPING_ID -
How to use directory alias in Java stored procedure ?
hi everyone !
I want use Directory alias in Java strored procedure
I 'hv created dir alias as
Create Directory BFILE_DIR AS 'C:\MyImages'
my java statements -
myfile="C:\MyImages\myPH01.jpg"
File binaryFile = new File(myFile);
instead of giving absolute path I want give directory alias BFILE_DIR
myfile= BFILE_DIR + "myPH01.jpg"
File binaryFile = new File(myFile);
can anyone pl suugest how should I write this in Java procedure
thanks
SPDhi everyone !
I want use Directory alias in Java strored procedure
I 'hv created dir alias as
Create Directory BFILE_DIR AS 'C:\MyImages'
my java statements -
myfile="C:\MyImages\myPH01.jpg"
File binaryFile = new File(myFile);
instead of giving absolute path I want give directory alias BFILE_DIR
myfile= BFILE_DIR + "myPH01.jpg"
File binaryFile = new File(myFile);
can anyone pl suugest how should I write this in Java procedure
thanks
SPD -
How to use dbms_Scheduler.Create_Job from within stored procedure?
Hello,
using 10g (10.1.0.2.0) on Windows 2000 I had problems to create scheduler jobs from within a stored procedure (see example below). What easily succeeds using anonymous blocks failed when calling from a stored procedure, due to ORA-27486. Only when I compile the procedure with invoker's rights the call to dbms_Job.Create_Job is successfull!? From my knowledge there is no difference between invoker's and definer's rights, if I compile and call with the same user, is there?
Does anyone know the reason for this behaviour or is it simply a bug?
Have a nice day.
Björn Hachmann
Hamburg / Germany
-- Example start.
create table t
a number(1),
b date default sysdate
create or replace procedure sched1
is
begin
dbms_scheduler.create_job(
job_name => 'TEST_JOB1',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN insert into t values (1); END;',
repeat_interval => 'freq=secondly',
enabled => TRUE
commit;
end;
create or replace procedure sched2
authid current_user
is
begin
dbms_scheduler.create_job(
job_name => 'TEST_JOB2',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN insert into t values (2); END;',
repeat_interval => 'freq=secondly',
enabled => TRUE
commit;
end;
exec sched1; -- This call fails with ORA-27486.
exec sched2; -- This call succeeds!
/* Cleanup.
exec dbms_scheduler.drop_job('TEST_JOB1', true);
exec dbms_scheduler.drop_job('TEST_JOB2', true);
drop table t;
*/Your example code ran without problems for me on 10.1.0.3.0 so it probably is a bug.
-
How to pass global variables to call stored procedure in form personalizati
Hi,
We want to call a custom store procedure with 2 paramterts, I am storing values into 2 global variables.
We want call the custom store procedure with global variable values in form personalizations.
We tried like
='declare
begin
SUR_TEST_ORDER_LINE_UPD.update_order_line (:global.xx_line_id, :global.ship_set_id);
end'
Could you please suggest.
Advance Thanks
SubbuHi,
Doc number (MOS Doc 743490.) is avaiable in metalink or ?Yes.
Note: 743490.1 - Customization in Oracle Applications
https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=743490.1
Regards,
Hussein -
Executing a Variable in a Stored Procedure containing an Update Statement
Hi,
I have created a Stored Procedure, it has one input parameter. Inside the Stored Procedure there are 5 other variables are declared, based on the input parameter 4 of these variables are populated.
Fifth variable is a a concatenation of text and some of these variables and creates a dynamic Update Statement. Once it is created I want to execute this variable but it is not executing.
Could someone please help me in knowing how to execute a variable within a stored procedure that contains an update statement.
Thanks for your help.
Thanks
Vineesh
vineesh1701If you have set up the variable so that it contains a valid sql update, it should work. For example, see below, which does do an update
use tempdb
go
Create Table #Test(i int);
Insert #Test(i) Values(1);
go
Create Procedure TestProc As
Begin
Declare @SQL nvarchar(250);
Set @SQL = 'Update #Test Set i = 2';
--Print @SQL;
Exec sp_executesql @SQL;
End
go
Exec TestProc
-- Test Result
Select * From #Test;
go
Drop Procedure TestProc;
go
Drop Table #Test;
One thing I would recommend while testing is that you print out or select the variable that contains the dynamic sql. (Like the above code where I have a print statement. That lets you see exactly what you are executing and if there is any problem
with the update command.
As Naomi said, to get anything more than general help, you will probably have to show us your code and the parameter values you are passing when you execute the stored proc.
Tom -
How to use Bind Variables in Essbase data control
Hi,
I am trying to use Bind Variables in MDX query while creating the Essbase Data Control. I have used the below query with the Bind Variable.. this query is working in Essbase admin console..but it is throwing error (*Invalid MDX Query)* while creating Essbase Datacontrol in JDeveloper.
MDX Query : SELECT {[Measures].Msr_2} ON COLUMNS, [Time].Children ON ROWS FROM cube
where ($name)
Could any body suggest me on how to use bind variables with Essbase Data control.
Thanks,
SwathiHello Swathi, can you please help me how you created Essbase DataControl? Also were you able to figure out this?
Thanks, Praveen. -
How to use the variables used in the message mapping
Hi ,
In the message mapping we can declare variables in the JAVA section , these variables could be used across the mapping .
I have tried using it but I am unable to retrieve the values assigned to the variables in one UDF into the another UDF .
Please guide me how to use the variables declared in the JAVA section in the message mapping .
Thanks
Anita YadavAnita,
I have worked on the Global variables and i found no issues. Make sure that the variable is declared in the Declaration Section and then initlaized in the Initialization section.
If you declare a variable in the Declaration Section ,
int i;
then in any udf you can use if directly. No need to re declare the variable in the UDF. If you do this, then it becomes a local variable.
Regards,
Bhavesh -
How can use a variable in the folowing code?
How can use a variable 'W_ROWNUM2' in the folowing code?
MOVE '1' TO CNT.
LOOP AT L_T_PM2.
CONCATENATE '0' CNT INTO W_ROWNUM2.CONDENSE W_ROWNUM2.
CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
perform DYNPRO_FIELD using FLD2
L_T_PM2-vari12_con.
CNT = CNT + 1.
CONDENSE CNT.
ENDLOOP.
I need to increment the value of W_ROWNUM2.
Please ,it is urgent!!Hello
CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
Try using spaces between parts of the resulting string.
CONCATENATE 'F110V-VARI' W_ROWNUM2 '(01)' INTO FLD2
Regards
Greg Kern. -
How to use bind variables in the following query
CREATE OR REPLACE PROCEDURE MMDB.test IS
sel_qtn VARCHAR2 (10);
CURSOR PT_QUANTITY IS select * from mmdb.product_tree WHERE QUANTITY_CHECK ='E'
AND run_id = 100
a PT_QUANTITY%ROWTYPE;
BEGIN
FOR i IN PT_QUANTITY
loop
sel_qtn := i.quanttity-1;
While sel_qtn>=1
loop
insert into mmdb.product_tree (BILLING_ACCOUNT_NO ,S_CODE) values (i.BILLING_ACCOUNT_NO ,i.S_CODE||'E');
sel_qtn :=sel_qtn -1;
End loop;
commit;
end;Don't duplicate threads: How to use bind variables in the following query
-
How to use outer join condition in my below query.
Hi All,
How to use outer join condition in my below query.
In the table APPS_JP.GEDIS_OFFER_HEADER goh I have more records
in the table APPS_JP.GEDIS_ORDER_BUILDS gob I have less number of records.
I want all the records from APPS_JP.GEDIS_OFFER_HEADER goh
including other conditions.
I have tried goh.OFFER_NO=gob.OFFER_NO(+) but same result.
[code]SELECT GOH.ORIG_SYSTEM,
gsp.USER_NAME,
goh.ORDER_NO,
goh.OMEGA_ORDER_NUMBER,
goh.ORDER_TYPE,
gc.CUSTOMER_ID,
gc.OMEGA_CUSTOMER_NUMBER,
CASE WHEN gc.PRIVATE = 'N' THEN gc.CUSTOMER_NAME ELSE '' END
AS COMPANY_NAME,
goh.ORDER_STATUS,
goh.TOTAL_SELLING_PRICE,
goh.TOTAL_MARGIN,
ga1.ADDRESS1
|| ','
|| ga1.ADDRESS2
|| ','
|| ga1.ADDRESS3
|| ','
|| ga1.POSTAL_CODE
|| ','
|| ga1.CITY
AS SHIPPING_ADDRESS,
ga2.ADDRESS1
|| ','
|| ga2.ADDRESS2
|| ','
|| ga2.ADDRESS3
|| ','
|| ga2.POSTAL_CODE
|| ','
|| ga2.CITY
AS BILLING_ADDRESS,
ga.ADDRESS_ID,
gol.DESCRIPTION,
APPS_JP.TZ.to_local_date (goh.OFFER_DATE, goh.OFFER_DATE_UTC)
AS OFFER_DATE,
gc.LEVEL_8,
goh.NO_OF_BUILDS,
gob.SFDC_ID,
goh.PURCHASE_ORDER_NO AS PO,
gc1.CUSTOMER_NAME AS END_USAGE,
gol.LOB,
goh.TOTAL_MARGIN_PCT,
goh.TOTAL_DISCOUNT,
goh.TOTAL_DISCOUNT_PCT
FROM APPS_JP.GEDIS_OFFER_HEADER goh,
APPS_JP.GEDIS_ORDER_BUILDS gob,
APPS_JP.GEDIS_ORDER_LINES gol,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER gorc,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER ship,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER bill,
APPS_JP.GEDIS_CUSTOMER gc,
APPS_JP.GEDIS_CUSTOMER gc1,
APPS_JP.GEDIS_CONTACT gct,
APPS_JP.GEDIS_ADDRESS ga,
APPS_JP.GEDIS_ADDRESS_NORM ga1,
APPS_JP.GEDIS_ADDRESS_NORM ga2,
(SELECT DISTINCT SALESPERSON_ID, USER_NAME
FROM APPS_JP.GEDIS_SALESPERSON
WHERE SALESPERSON_ID IN
(SELECT TO_NUMBER (COLUMN_VALUE) AS SALESPERSON_ID
FROM TABLE (APPS_GLOBAL.SplitString ('337309'))))
gsp
WHERE goh.ORDER_NO <> 0
AND goh.OFFER_NO <> 0
AND goh.OFFER_NO=gol.OFFER_NO
AND gol.BUILD_NO = 1
AND gol.LINE_NO = 1
AND goh.OFFER_NO=gob.OFFER_NO
AND gob.BUILD_NO = 1
AND goh.OFFER_NO = gorc.OFFER_NO
AND gct.CONTACT_ID = gorc.CONTACT_ID
AND ga.CUSTOMER_ID = gc.CUSTOMER_ID
AND ga.PRIMARY = 'Y'
AND goh.LEAD_SALESPERSON=gsp.SALESPERSON_ID
AND goh.OFFER_NO = ship.OFFER_NO
AND ship.RELATION_TYPE = 'SHIP'
AND ga1.ADDRESS_ID = ship.ADDRESS_ID
AND ga1.CUSTOMER_ID = gc1.CUSTOMER_ID
AND goh.OFFER_NO = bill.OFFER_NO
AND bill.RELATION_TYPE = 'BILL'
AND ga2.ADDRESS_ID = bill.ADDRESS_ID
AND goh.OFFER_DATE BETWEEN APPS_JP.TZ.LOCAL_TO_DB_DATE (
SYSDATE - 30
AND APPS_JP.TZ.LOCAL_TO_DB_DATE (SYSDATE)
AND gorc.RELATION_TYPE = 'BASE'
AND gorc.CUSTOMER_ID = gc.CUSTOMER_ID
AND goh.SALES_CHANNEL = gc.SALES_CHANNEL
AND gc.SALES_CHANNEL = 'SMB'
AND goh.LEAD_SALESPERSON IN (goh.CREATED_BY, goh.LEAD_SALESPERSON)
ORDER BY goh.OFFER_NO;[/code]
Please help me how to use this outer join condition.
Thanks in advance.Hi,
If you want all the rows from goh, then you don't want any conditions like goh.OFFER_NO <> 0.
Make all the joins to goh outer joins, and make all conditions that apply to any tables joined to goh (or to tables joined to them) part of the join condition, like this:
FROM APPS_JP.GEDIS_OFFER_HEADER goh
LEFT OUTER JOIN APPS_JP.GEDIS_ORDER_BUILDS gob ON gob.OFFER_NO = goh.OFFER_NO
AND gob.BUILD_NO = 1
LEFT OUTER JOIN APPS_JP.GEDIS_ORDER_LINES gol ON gol.OFFER_NO = goh.OFFER_NO
AND gol.BUILD_NO = 1
AND gol.LINE_NO = 1
LEFT OUTER JOIN APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER
gorc ...
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Simplify the problem as much as possible. For example, do you really need all those tables to show what the problem is? Of course, you need them in tyour real query, but if you understand a solution that only involves 4 or 5 tables, you'll know how to apply it to any number of tables.
Explain, using specific examples, how you get those results from that data.Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ https://forums.oracle.com/message/9362002#9362002 -
How to use bind variables in this procedure
Hi Experts,
How to use bind variables in this procedure for static queries.
PROCEDURE DELETE_MER_PROC (M_id IN NUMBER)
IS
BEGIN
V_date DATE;
SELECT PD_DATE INTO v_date FROM PD_MAINTAIN;
DELETE FROM MER_CLEAR
WHERE MER_DT < v_date
AND ID = M_ID;
COMMIT;
END;
How to use v_date and m_id as bind variables in this procedure to avoid hard parsing.
Please help me.
Thanks.976208 wrote:
How to use v_date and m_id as bind variables in this procedure to avoid hard parsing.
You cannot avoid hard parsing - as the 1st time a SQL statement (like the SELECT or DELETE statements in your code) is encountered, it does not reside in the server's Shared Pool, and needs to be added into the pool via a hard parse.
Bind variables does not prevent hard parsing. Hard parsing happens when the SQL statement (with or without bind variables) is a brand new statement encountered by the server.
Bind variables enables the same SQL cursor to be reused, by simply changing the bind variable value.
Not using bind variables means that each SQL statement is unique and not shareable - as the value is hardcoded into the statement and cannot be changed via a bind value. This typically means LOTS of different SQL statements (where the only difference is the changed value in the statement) are created - with each statement being a new statement not seen before in the Shared Pool and needing to be hard parsed.
One does not design one's code not to be hard parsed. There ALWAYS will be a hard parse in order to get a SQL statement into the Shared Pool. One designs one's code to REUSE cursors in the Shared Pool.
Maybe you are looking for
-
Import oracle 11g database into oracle 10g Server -
Hi guys, We have a oracle db running on Oracle 11g. Now, we would like to export from oracle 11g into Oracle 10g XE for important demo. Is it possible?? When i try to import into Oracle 10g XE, the following Error msg appears : IMP-00010: Not a valid
-
A recent article from TechRebulic which I subscribe to, has highlighted a security risk associated with in-App advertising on the android platform using a tool called AdRisk to automate and identify the risks with a particular App association, and co
-
GridBagLayout - distributing real estate equally
I have two columns that contain different components, when running the app, the user enlarges the window, the real estate doesn't distribute 50/50 to the column widths I know that by default any extra real estate is added to the bottom right componen
-
I have Photoshop CC why is my 3D menu grayed out?
I have Photoshop CC why is my 3D menu grayed out? I preferences it says open GLDrawing must be enabled to use these settings. What does that mean?
-
I am a cloud member but i cannot log into business catalyst could you help me
I am a cloud member but i cannot log into business catalyst could you help me I can log ino all my other adobe program but business catalyst will not let me connect