How can I open a cursor for dynamic sql statement

Hi,
I'm facing issues opening a cursor for dynamic sql statement : PLS-00455: cursor 'RESULT1' cannot be used in dynamic SQL OPEN statement.
CREATE OR REPLACE FUNCTION DEMO
(MN_I in VARCHAR)
return AB_OWNER.ABC_Type.NonCurTyp is
RESULT1 AB_OWNER.ABC_Type.NonCurTyp;
sql_stmt VARCHAR2(4000);
BEGIN
sql_stmt := 'SELECT * FROM AB_OWNER.DUN WHERE JZ_I in ('||mn_i||') ORDER BY app.ACC_I';
OPEN RESULT1 FOR sql_stmt;
END IF;
return RESULT1;
END DEMO;
What changes should I make in the code so that it doesn't fail? I can't change the definition of RESULT1 cursor though.

Gangadhar Reddy wrote:
I used SYS REFCURSOR and was able to implement successfully.How many times did you run this successful implementation that does not use bind variables?
Because this is what will happen when it runs a lot.
http://download.oracle.com/docs/cd/E11882_01/server.112/e17766/e2100.htm#sthref1874
http://forums.oracle.com/forums/search.jspa?q=%2BORA-04031%20%2Bbind&objID=c84&dateRange=all&rankBy=10001&start=30
And you will have to regularly restart the server, or possibly slightly less invasive, flush the shared pool.
Flushing Shared Pool regularly
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1516005546092
>
Ok, this is an easy one to diagnose.
You are not using bind variables. This is terrible. Flushing the shared pool is a bad
solution -- you are literally killing the performance on your box by not using them.
If I was to write a book on how to build “non scalable applications in Oracle”, this
would be the first and last chapter. This is a major cause of performance issues and a
major inhibitor of scalability in Oracle. The way the Oracle shared pool (a very
important shared memory data structure) operates is predicated on developers using bind
variables. If you want to make Oracle run slowly, even grind to a total halt – just
refuse to use them.
>
But, please feel free to go ahead with this successful implementation.
I just hope anyone else who reads this doesn't make the same mistake.

Similar Messages

  • HT1529 how can I open the outbox for mail? That is, mail that i have finished and pressed 'send' but has not appeared in the 'sent' folder

    how can I open the outbox for mail? That is, mail that i have finished and pressed 'send' but has not appeared in the 'sent' folder

    The reason it will not be in the sent folder is, it failed to send.
    If it failed to send, then you will see the Outbox icon. 'Pending' would be a more descriptive name.
    When it eventually sends, the Outbox will not show in the Mail app interface.
    Until it is sent it will stay stuck in the Outbox.
    If it refuses to send, you can manually delete it in Finder, at the location ~/Library/Mail/Mailboxes/Outbox.mbox
    Close Mail first, before you search for that email using the Finder.
    Mail version 4.6. Mac OS version 10.6.8

  • I've bought an iphone 4 last year in the states and i live in israel how can i open my iphone for calls ? i have ios 5, i've bought an iphone 4 last year in the states and i live in israel how can i open my iphone for calls ? i have ios 5

    how do i open my iphone for israeli operation system like pelephone or orange ?
    i bought it last year in san diego

    If you bought a phone with a carrier plan, you can't "unlock" it. You will need to buy a factory unlocked iPhone.

  • How can i open my iphone for all the net works???

    hello guys
    my iphone lock to the at&t network
    how can i open him??
    help me please...

    The phone is locked by contract to AT&T.  Therefore the only way of breaking the contract is via AT&T.  You do not have any contract with Apple. Apple has nothing to do with the locking of your phone.

  • Concatenate problem for Dynamic SQL statements

    Hi Experts ,
    I am building Dynamic SQL statements depending on the values which the user enters into the select option parameters .This dynamic query is passed to cl_sql_connection object for querying from another databasse
    So i wrote dynamic values for one select option spointof for the database field ppointofdelivery.
    loop at spointof.
    CONCATENATE ' pointofdelivery between ''' spointof-low''''
    ' AND ''' spointof-high''''
    INTO where_clause .
    endloop.
    The whereclause has value pointofdelivery between '123' and '124'.(if the user has entered 123 and 124 as values)
    This works fine . But my problem is I have to pass the fieldnames and operator dynamically into where_clause depending on User input.
    when i am writing code like the below
    field_name = ' pointofdelivery '.
    operator = '='.
    CONCATENATE field_name operator '''spointof-low''' INTO where_clause .
    the where_clause contains value
    pointofdelivery = ' spointof-low '
    and not pointofdelivery = ' 123 ' as expected .
    Do you know why this is haapening as it is not taking the value.
    Thanks
    Arshad

    Hi,
    there are lot of function modules..available...to build a where clause based on the select-options..
    check the FM FREE_SELECTIONS_RANGE_2_WHERE
    Thanks
    Naren

  • Open cursor for dynamic sql

    Hi
    I am using oracle 8.1.7 on solaris.
    I have created
    SQL> CREATE OR REPLACE PACKAGE TEST_PKG AS
    2 TYPE row_cursor IS REF CURSOR RETURN TEMP_TAB%ROWTYPE;
    3 PROCEDURE Return_Columns_proc (c_return IN OUT row_cursor);
    4 END TEST_PKG;
    5 /
    Package created.
    now i am trying to create the procedure Return_Columns_proc by
    CREATE OR REPLACE PACKAGE BODY TEST_PKG AS
    PROCEDURE Return_Columns_proc (c_return IN OUT row_cursor) AS
    QUERY_STR VARCHAR2(850);
    x number ;
    BEGIN
    x:=1;
    QUERY_STR :='SELECT * FROM temp_tab where order_line_id = '||x;
    OPEN c_return FOR QUERY_STR;
    END Return_Columns_proc;
    END TEST_PKG;
    I am getting following error.
    SQL> show error
    Errors for PACKAGE BODY TEST_PKG:
    LINE/COL ERROR
    8/4 PL/SQL: Statement ignored
    8/9 PLS-00455: cursor 'C_RETURN' cannot be used in dynamic SQL OPEN
    statement
    any help for this error.

    The error says it all. You have defined a strong ref cursor and it cannot be used with dynamic sql. However, that does not mean you cannot use the query directly in the OPEN clause
    OPEN c_Return FOR SELECT * FROM temp_tab where order_line_id = X ;

  • Spark datagrid - how can i open entire row for editing?

    Hi,
    I want to create a datagrid with add button. The user can add a row and i want all the editable columns to be opened for editing.
    I can open a single cell for editing by using startItemEditorSession, but how can i do it for multiple columns in the same time?

    redskyventures wrote:
    it seems mine has automatically done so...
    I recommend you turn off the automatic update feature -- It can really cause you a lot of trouble.
    Have you already determined that your coauthor cannot open your file?  If so, I suggest you go backwards, get a copy of the old iBA from him to put on your machine, so you both use the same version.  There's no way to convert iba files to anything, as far as I know.

  • How can i change the Cursor for the hole frame?

    I think this is quite a simple question:
    I would like to change the cursor for the hole Frame, while the programme is reading data from database.
    but with frame.setCousor(...) i get a compiler-error.
    Thank you

    I think this is quite a simple question:
    I would like to change the cursor for the hole Frame,
    while the programme is reading data from database.
    but with frame.setCousor(...) i get a compiler-error.
    Thank youHello,
    there shouldnt be any compiler-error.
    Post some code and we will help.
    docs:
    /**Sets the cursor image to the specified cursor.
    This cursor image is displayed when the contains method for this component returns true for the current cursor location,
    and this Component is visible, displayable, and enabled.
    Setting the cursor of a Container causes that cursor to be displayed
    within all of the container's subcomponents, except for those that have a non-null cursor.*/
    public void setCursor(Cursor cursor)regards
    tim

  • My Site Branding - How can we have it applied for dynamically created My Sites? (/personal/username)

    Hi,
    I have a SharePoint 2013 environment in which My Sites are enabled.
    As you know the My Site of every user gets created in /personal/Username dynamically, when a User goes to his "My Site" from the "About Me" link.
    The requirement is for us to apply a custom master page / styles for the all My Sites
    How do we do this in a way - where it gets applied for all the existing My Sites and also the My Sites that will get created in the future? What will be the right help?
    Please help on this.
    Karthick S

    Hi Karthick
    You can do it using feature Stapling
    http://sharepointologic.blogspot.in/2013/04/branding-sharepoint-2013-my-sites-with.html
    https://sharepointqna.wordpress.com/2013/08/29/my-site-master-page-change-feature-stapling/
    Please mark it as answer if it helps you solving your problem
    Amit Kotha

  • Please very urgent How can i call focus event for dynamic created txtbox

    Hi,
    I create a one texbox using javascript .now i want to call onFocus event that textbox.How is it

    Hi,
    I create a one texbox using javascript .now i want to
    call onFocus event that textbox.How is itJust for you, slowly, so you can understand:
    Javascript was invented by Netscape and is a scri�ting language for browsers.
    Java is a programming language invented by Sun.
    Compare:
    Netscape. Sun.
    Notice a difference?

  • How can I open hardware acceleration for safari 5.1.1 in Windows 7?

    It is said that safari 5 for windows supports hardware acceleration now. But I cannot open this feature in my Windows 7 laptop. Is there any way to open this feature manually?

    I know Safari a little and 5.1 can come to its knees easily and repeatedly.
    At first I thought it lasted longer if:
    disble java, plugins, javascript
    run only in Private Browsing mode
    disable web cache
    I'd like to see it launch with cache disabled and like firefox always start in Private mode.
    Plus site specific preferences
    Still accepts ad and tracking cookies - must consider those to be "well you visited the site" so the site can set whatever it wants.
    I'll use Opera 11.50 instead.
    I tried Windows "trobleshoot compatibility" it wants to set to run it in XP SP3 mode and at the end "incompatible application".
    Settings applied:
    XP SP2 mode
    Disable Aero (iTunes will lose video/movie Window if the desktop is locked for UAC)
    I've lost all borders of windows and tabs, freezes or locks up but no sign of  not responding even though I can't do anything - but I could close Windows and tabs from the Task bar.
    Total PITA and waste of time as I investigate, remove and check for conflicts with Kaspersky and others.

  • How can I open Camera RAW for Nikon D7100 with CC?

    Downloaded the trial version of Photoshop CC 2014 yesterday but it could not open the RAW file created by my newly purchased Nikon D7100. Please help.
    Regards

    One issue that can cause this is using Nikon software to transfer or view the raw images that is older than the camera.  This is known to corrupt the image and make the unrecognizable to Adobe software.  You can reverse this corruption using a utility found here:
    http://owl.phy.queensu.ca/~phil/exiftool/fix_corrupted_nef.html
    A way to test if this is the issue would be to transfer new raw images from the camera or card to your computer without using Nikon software, but instead using the OS apps like Explorer or Finder.

  • How can i open my iphone for globe network in philippines

    My iphone 4s was bought in saudi arabia. Unfortunately i cannot use it in philippines it doesnt recognize globe networks here. Can u please help

    Only the carrier ti which it is locked can unlock it.
    Contact that carrier and ask if they offer this service and if you qualify.

  • How to query using CGI path for 'IN' sql statement

    Some problems that requires help:
    I have a report that requires a query which has 'IN' statement in SQL query. For example: SELECT EMP_ADDRESS1 FROM EMPLOYEE WHERE EMP_NO IN (:EMP_NO).
    I am going to query the result of this query using CGI. My peoblem starts here - I can't be passing a list of parameter for ':EMP_NO' because the path does not accept escape characters. I can't be put a query path below:
    <HTML>http://172.188.2.7/dev60cgi/rwcgi60.exe?server=9iAS&mode=default&destype=localfile&desformat=\\pri_wnt\generic&report=gcgd1.rdf&userid=comm/comm@employee<B>&emp_no='A','B','C'<B></HTML>
    What I am doing is that I will have a front end written in JAVA and display a listing of Employee available in the company. The user will be able to choose whatever employee on the front end. Then, I will call the CGI path to display the result to the user.
    Pls help. Kindly email personally([email protected]) or reply here.
    Thank you

    You'll need to escape your single quotes using %XX where XX is the hex code corresponding to the special character you want to use. I'm not sure what the escape code is for quotes. I know that if you wanted to have a space, this:
    ....../rwcgi60.exe?key+P_city='San Francisco'+....
    would need to look like:
    .../rwcgi60.exe?key+p_city=San%20Francisco+...
    You'll need to find out what the number for quote is. HOpe that helps a bit.
    Toby

  • How do I use bind variables for the SQL statements having IN clause

    SELECT id, name FROM t
    WHERE id in (10,20,30)
    As the IN list will have 'n' number of values, I am not able to specify fixed number of bind
    variables like
    SELECT id, name FROM t
    WHERE id in (?,?,?....)

    452051 wrote:
    I am not able to specify fixed number of bind variablesYou could use collection:
    SQL> create or replace force
      2    type NumList
      3      as
      4        table of number
      5  /
    SQL> select ename from emp where deptno member of NumList(10)
      2  /
    ENAME
    CLARK
    KING
    MILLER
    SQL> select ename from emp where deptno member of NumList(10,20,30)
      2  /
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    ENAME
    JAMES
    FORD
    MILLER
    14 rows selected.
    SQL> This way you have one bind variable - collection.
    SY.

Maybe you are looking for

  • How to digitally record audio? (iPad to MAC)

    Hello, I am generating sounds internally in my iPad 3 and I play it through the earphones. The thing is that I would like to record the generated samples in its digital form using a MAC Book Pro. We are doing it doing in its analog form but we are no

  • Sum by and drill down

    hi, there are 3 levels in a dimension (grand total level , market and sub market) due to the complicated setting in RPD, I cannot use the normal method to GET "grand total" of a table. I found that I need to use "SUM(value BY market)" in the column f

  • Difference between 'LIKE' and 'TYPE'

    Hi all, I am new to learning ABAP, kindly bear with my naive questions......... can you please tell me what's the difference between 'type' and 'like' keyworkds. also what does 'condense' do. thanks Sabrina.

  • Looking for Driver for HP 3500 Color Laserjet for Windows 7. Is there a Generic I can use?

    I've been checking HP for 18 months and can never locate a driver for this Printer. Does anyone have any suggestions?

  • Can't share wireless

    To whomever can help me, I have had the Time Capsule for almost two years. I never had a problem using multiple devices to obtain the internet. I moved to Japan and have it connected to ethernet ( I was using a cable modem stateside) I can't get my i