Different session values when passing &APP_SESSION. as a parameter

Hi all,
I'm using APEX 3.1.1 and having the following issue: I have a JS function in my app, which builds an URL using the parameters provided. Its signature would look something like:
function xxx(p_app_process, p_param_item, p_session, p_app_id)
Yes, I'm using this to call an on-demand application process (AJAX magic ;)
The problem is that when I call it from a page item using &APP_SESSION. for the 3rd parameter, it seems like for some reason JS is receiving a different value (I verified this myself putting an alert and displaying both the parameter value and the &APP_SESSION. substitution string).
I know you will say, +"then why don't you use &APP_SESSION. instead?"+ but the thing is, my JS code is in a separate file, and for whatever reasons, APEX won't replace that string on that separate file.
So... any suggestions? Ideas? New approaches?
Thank you all in advance for your help.
Regards,
Aníbal

Hello,
In an external file you can use -
$x('pInstance').valueor
$v('pInstance')(depending on your version of APEX)
to reference the value of the current session.
Hope this helps,
John.
Blog: http://jes.blogs.shellprompt.net
Work: http://www.apex-evangelists.com
Author of Pro Application Express: http://tinyurl.com/3gu7cd
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

Similar Messages

  • Different session used when calling stored procedure from form

    after commiting data in a form to a table, a stored procedure is called that inserts the data written to the table into several other tables. Some columns in the original table are updated - no commit is issued in the procedure. On returning from the procedure the form is re-queried but the updated columns don't contain the updates. This seems to imply that the stored procedure is running as a different session to the one of the form.
    Is this the case? Can we make the form and the stored procedure use the same session so that the data is available in both without having to commit in the procedure?

    No. They should be within one session unless you explicitly open a new session.
    The reason why you dont see updates of the data block when you requery is probably the changes on the form never go to the back end. I think first you have to make sure data changes go to db table. You can do a commit_form before calling the stored procedure and open up another session (e.g. sqlplus) to check the data in the table changed or not.

  • Unable to refer a OAF form field value and pass it as a parameter

    Hi,
    I have a requirement to call a custom Oracle form from a OAF Page (Purchase Agreements form).
    Using personalization I have created a button on the OAF page and have set its Destination function to
    form:PO:XXOX_PO_SU_OCM_FG:STANDARD:XXOX_QTY_ADJ:BA_TYPE=BPA BA_VALUE=5307
    BA_TYPE and BA_VALUE are two parameters defined on the Oracle form.
    I am able to see th Button on the OAF page and when i click on it, it opens up the custom form.
    The issue is that I am currenctly passing a hard coded value (5307) to the form parameter.
    I actually would like to use the field name on the OAF page and pass the value in it to the form parameter.
    I tried doing it the following few ways, but i get an error messageas
    FRM-47023: No such parameter named G_QUERY_FIND exists in form <Form Name>
    FRM-40105: Unable to resolve reference to item PARAMETER.G_QUERY_FIND.
    FRM-47024: Parameter BA_VALUE type does not match definition in form <Form Name>
    form:PO:XXOX_PO_SU_OCM_FG:STANDARD:XXOX_QTY_ADJ:BA_TYPE=BPA BA_VALUE=poHeaderId
    form:PO:XXOX_PO_SU_OCM_FG:STANDARD:XXOX_QTY_ADJ:BA_TYPE=BPA BA_VALUE=&poHeaderId
    form:PO:XXOX_PO_SU_OCM_FG:STANDARD:XXOX_QTY_ADJ:BA_TYPE=BPA BA_VALUE=pageContext.getParameter("poHeaderId")
    form:PO:XXOX_PO_SU_OCM_FG:STANDARD:XXOX_QTY_ADJ:BA_TYPE=BPA BA_VALUE="{@poHeaderId}"
    form:PO:XXOX_PO_SU_OCM_FG:STANDARD:XXOX_QTY_ADJ:BA_TYPE=BPA BA_VALUE=pageContext.getParameter("PoHeadersSummaryVO.poHeaderId")
    form:PO:XXOX_PO_SU_OCM_FG:STANDARD:XXOX_QTY_ADJ:BA_TYPE=BPA BA_VALUE=pageContext.getParameter("oracle.apps.po.document.server.PoHeadersSummaryVO.poHeaderId")
    form:PO:XXOX_PO_SU_OCM_FG:STANDARD:XXOX_QTY_ADJ:BA_TYPE=BPA BA_VALUE=PoHeadersSummaryVO.poHeaderId
    form:PO:XXOX_PO_SU_OCM_FG:STANDARD:XXOX_QTY_ADJ:BA_TYPE=BPA BA_VALUE=oracle.apps.po.document.server.PoHeadersSummaryVO.poHeaderId
    Any help on this will be great
    Thanks
    Srinivas Reddy

    Hi,
    I have a similar issue.
    The data type of the form parameter is Number
    where that of the page paramenter is oracle.jbo.domain.Number
    I hav converted the datatype using to_number via form personalization. There is no error but value is not getting passed.
    pls let me know if anyone has a workaround/solution for this.
    Thanks,
    Pragati

  • "Missing parameter values " when passing parameter to subreport

    i have a subreport embedded in main report.
    sub report take a procedure with parameter.the main report does nothing but only holds many sub report.now i have to pass parameter from code to sub report.ive used the following code but it gives "missing parameter values" error
    Any help??
       ParameterField paramField = new ParameterField();
            ParameterFields paramFields = new ParameterFields();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
            paramField.Name = "@LabNo";
            paramDiscreteValue.Value = "1034";
            paramFields.Add(paramField);
            ParameterValues paramvalues = new ParameterValues();
           paramvalues.Add(paramDiscreteValue);
            paramField.CurrentValues.Add(paramDiscreteValue);
    rptDocument.ParameterFields[0].CurrentValues = paramvalues;

    does the sub report have parameters in it as well?
    if the sp used for the sub report has parameters you need to pass them to the sub. i would probably remove the parameters from the sub and join the sub to the main by the parameter from the main to the field in the sub.

  • What do I miss when passing an URL a parameter to a query?

    Hello,
    Here I am again with my problem. I am trying to understand what happens behind the whole thing to achieve the best performance.
    I have a single page which accepts a parameter. Since I must have one page I cannot use the "ExecuteWithParameters" method for passing parameters.
    This page has one VO with a bind variable. The query takes a lot of time to compute.
    For now to use a paramter from the URL I do the following:
    1. In the page properties I associate a parameter with a variable in the sessionScope (I need it to be in the session):
    <from-value>#{param.my_param}</from-value> <to-value>#{sessionScope.my_param}</to-value>
    First doubt: is anything in the sessionScope defined as above available immediatly without registering any bean?
    2. Next step is to go in the pageDefs and define a methodCall with an InvokeAction:
    <executables>
    <variableIterator id="variables"/>
    <page path="oracle.ui.pattern.dynamicShell.model.dynamicTabShellDefinition"
    id="pageTemplateBinding" Refresh="ifNeeded"/>
    *<invokeAction Binds="setmy_param" id="setParams"/>*
    </executables>
    <bindings>
    <methodAction id="setmy_param" RequiresUpdateModel="true"
    Action="invokeMethod" MethodName="setmy_param"
    IsViewObjectMethod="true" DataControl="AppModuleDataControl"
    InstanceName="AppModuleDataControl.TreeViewObj1">
    *<NamedData NDName="value" NDValue="#{sessionScope.my_param}"*
    NDType="java.lang.String"/>
    </methodAction>
    The method setmy_param is a VO method exported to the client.
    NOW:
    When the page starts and the UI component built on the VO is rendered, it looks like the VO keeps ignoring the bind variable set with the method.. I mean, it seems the query is executed BEFORE the setmy_param() is executed on the VO (no matter the order of the bindings in the pageDef).
    For this reason the only workaround seems to be to RE-EXECUTE the query in the method. But this takes a lot of time since the query is time consuming. Is there a way to associate the parameter to the bind variable in VO BEFORE the first execution of the query at the start of the page, basically when the component based on VO is rendered?
    Thanks.

    I missed this
    Refresh="prepareModel"
    in the InvokeAction section

  • Get a insert session value for SQL query at report

    Hi friends
    I created a global temp table and procedure to support web search form.
    and a search result report. The procudure
    gets search result from multip tables and
    insert into temp table --recordsearch. I can get value from temp table  by call procedure
    at SQL*Plus.
    However, I can not get this value by web report.
    How can I get this insert session value and pass to SQL query for report?
    Thanks,
    Newweb
    CREATE GLOBAL TEMPORARY TABLE recordsearch
    (emp_id          VARCHAR2(200),
    ssn               VARCHAR2(9),
    fname          VARCHAR2(200),
    lname           VARCHAR2(200),
    m_name          VARCHAR2(200)
    ) ON COMMIT PRESERVE ROWS;

    it possible that your web form does not have a persistent, dedicated connection. if you have connection pooling for example, multiple sessions will see the same instance of the GTT, so if one deletes it, then nobody sees it (or you can see others data). if the connections are not persistent, then they can disconnect between calls, deleting the GTT table.

  • Renewing a session value on page render.

    Hi,
    Does anyone know of an easy way of renewing the session value when a page is loaded.
    I have an app that is mostly public so logging in is not required for most of it. When the user returns to the initial page (probably using the browser buttons) I need the page to generate a new session value.
    Can this be done in a simple url. I tried creating a process Before Header with
    owa_util.redirect_URL('f?p=APP_ID.:6');
    i.e. without the &SESSION. value, hoping that this would force a new session to be created, but it doesn't work.
    Any ideas?
    Cheers
    Yog

    Yog - what version of HTML DB? And why do you want a new session created?
    Scott

  • Page 404 Error when passing Session values through URL

    The current application I'm working on is a 'Targeted Email Communications' application. Bascially, employees at the school at which I'm employed can go in and select services to recieve outage notification emails on.
    The problem I'm discussing in this post has to do with our so called 'Notification Summary Screen.' This screen is basically a report region which displays all outage notifications issued by this application. In the left-most column of this report, I have an edit button that when clicked, redirects the user to the 'Create / Update / Send Screen' with the primary key values passed through the URL. When this happens, all other page items query their values based on the NOTIF_ID passed in through the URL. All of this works fine.
    The problem is, on the Notification Summary Screen, I also have a button labeled 'Create a new notification.' This button redirects the user to the same page as before, except now all of the values are NULL because this outage notification has not yet been created. The problem is, when I try and do this - I get a page 404 not found error. I'm pretty sure it's because my application is getting confused because earlier all of the values were passed in through a URL. For the 'Create New' button, I clear the page cache for this page - and it still does nothing. I am at a loss for what to do here because I keep getting the error.
    Here's the code for the URL button found in the report query in the 'Notification Summary Screen' :
    ('<a href='
              || 'f?p=&APP_ID.:2:&SESSION.::&DEBUG.::'
              || 'P2_NOTIF_ID,P2_NOTIF_SEQ,P2_INFO_TYPE:'
              || a.notif_id ||','|| b.notif_seq || ',' || 'Update'
              || '>'
              || '<img src="#APP_IMAGES#EditButton.gif" />'
              || '</a>') as "edit",** NOTE, I took out the double quotes after href and before the closing right karat brackets because for some reason the code in the URL wouldn't display...weird.... **
    The NOTIF_ID value is the primary key identifier for each outage notification. Additionally, the NOTIF_SEQ value is the sequence number for each (because each notification could have multiple updates). The INFO_TYPE value just references whether this is 'Initial', 'Updated', or 'Closing' information.
    Any suggestions would be much appreciated.
    Eric
    Edited by: user11685190 on Nov 6, 2009 1:12 PM
    Edited by: user11685190 on Nov 6, 2009 1:13 PM
    Edited by: user11685190 on Nov 6, 2009 1:14 PM

    Hey you guys,
    Thanks for your responses. I actually just started working for this academic institution, and have to finish a probationary period before I have access to their VPN (5 Months). Therefore, I cannot access my workspace, nor will they allow me to export my application because it's considered their intellectual property. I believe it may be the &DEBUG portion of it.
    Though I cannot state the exact URL the error states, I can tell you that if I go into application builder to the page in question and try and run it before the page that links to it, I get the error. However, when I use the link everything works fine. When I use the 'Create New' button to link to the page with no values passed, I get the error again. I work again on Monday and will have more information then.
    Thanks again!
    Eric

  • How to pass session variable value with GO URL to override session value

    Hi Gurus,
    We have below requirement.Please help us at the earliest.
    How to pass session variable value with GO URL to override session value. ( It is not working after making changes to authentication xml file session init block creation as explained by oracle (Bug No14372679 : which they claim it is fixed in 1.7 version  Ref No :Bug 14372679 : REQUEST VARIABLE NOT OVERRIDING SESSION VARIABLE RUNNING THRU A GO URL )
    Please provide step by step solution.No vague answers.
    I followed below steps mentioned.
    RPD:
    ****-> Created a session variable called STATUS
    -> Create Session Init block called Init_Status with SQL
        select 'ACTIVE' from dual;
    -> Assigned the session variable STATUS to Init block Init_Status
    authenticationschemas.xml:
    Added
    <RequestVariable source="url" type="informational"
    nameInSource="RE_CODE" biVariableName="NQ_SESSION.STATUS"/>
    Report
    Edit column "Contract Status" and added session variable as
    VALUEOF(NQ_SESSION.STATUS)
    URL:
    http://localhost:9704/analytics/saw.dll?PortalGo&Action=prompt&path=%2Fshared%2FQAV%2FTest_Report_By%20Contract%20Status&RE_CODE='EXPIRED'
    Issue:
    When  I run the URL above with parameter EXPIRED, the report still shows for  ACTIVE only. The URL is not making any difference with report.
    Report is picking the default value from RPD session variable init query.
    could you please let me know if I am missing something.

    Hi,
    Check those links might help you.
    Integrating Oracle OBIEE Content using GO URL
    How to set session variables using url variables | OBIEE Blog
    OBIEE 10G - How to set a request/session variable using the Saw Url (Go/Dashboard) | GerardNico.com (BI, OBIEE, O…
    Thanks,
    Satya

  • Passing Session Values to the Tabular Form Element of a Report Column

    Hello,
    I'm running application express version 2.0 with a 10.2.0.2.0 database on a 32 bit windows box. I'm trying to figure out sneaky a way to pass the &APP_PAGE_ID., #APP_PAGE_ID# or V('APP_PAGE_ID'); as an element attribute of a Report Tabular Form Element set to display as a Select List (named LOV).
    It seems that whatever option I choose, the Element Attributes field will only render the literal value of what I have entered. This is part of the solution but I would like to find a way to pass the current page id.
    What I'm trying to do is utilize the ONCHANGE attribute to redirect to a report page in my application when the value from a Select List (named LOV) is selected.
    I could work around this by creating my own table output with PL/SQL and HTP.P commands but would really be interested in finding out if I can use the reporting structures which are already available through Application Express.
    Any ideas?
    Thanks.
    Justin.

    Thanks for the response Earl. To clarify this is what I've done and what I hope to achieve:
    I currently have a LOV for my application that identifies a number of database report types: DB Options, DB Parameters, DB Version, and so on.
    I have an application express report being generated for the databases I'm monitoring and it displays as follows:
    - HOST -- DBTYPE -------- DBNAME - DBREPORTS
    =====================================
    - SVR 1 - Oracle 9.2.0.1 - DEV -------- [LOV HERE]
    - SVR 2 - Oracle 9.2.0.7 - TST --------- [LOV HERE]
    I am displaying the LOV on my report the the options under the reports attribute tab in my application builder. I insert my LOV select list by editing the DBREPORTS column and set the "Display As:" option under Tabular Form Element to "Select List (named LOV)"; I have also added my LOV to the "Named LOV" option under List of Values.
    So far this achieves everything I would expect and works quite well (a select list with my report types appears in my monitor report for each DB that is returned).
    What I'm interested in doing now is opening a DBREPORT for a given database by simply choosing the report type from my LOV. I can set the "Element Attributes" option under Tabular Form Element to execute a javascript call for any valid event (in my case I'm using ONCHANGE).
    My only issue is that I cannot find a way to pass any session values from my page to my Element Attribute. If, in the Element Attributes field I enter:
    onchange="alert(this.value);" //my dialogue box will display the value of my current selection when I choose a report type.
    What I'd love to be able to do is something like:
    onchange="alert('&APP_PAGE_ID.');" //so my current page id is written to the element.
    Unfortunately, only my literal text seems to be rendered. Rather than having my dialogue come back with my page number, say 75, I receive the literal value &APP_PAGE_ID.
    Notwithstanding any quote issues, I've tried to dump a test html attribute to my source html by entering any of the following in the Element Attributes field:
    test=&APP_PAGE_ID.
    test=#APP_PAGE_ID#
    and as a shot in the dark knowing that I'm not using PL/SQL:
    test=V('APP_PAGE_ID');
    In every case when I view source I see the literal value of what was entered in the Element Attributes field (ie "test=&APP_PAGE_ID." instead of "test=75").
    What makes things a little more frustrating is that I can drop &APP_PAGE_ID. into the Column Heading field (ex My Heading &APP_PAGE_ID.), it renders as I would expect; "My Heading 75". If we could find a solution to this, I could see a number of slick uses for this type of functionality.
    Hope this helps,
    Thanks.
    Justin.

  • Will a sequence return same value for two different sessions?

    Is there a possibility that a sequence will return same value to two different sessions when it is referred exactly at the same instance of time?

    @Justin... Thanks for your insight; indeed, we too feel this shouldn't ever happen and never heard of it either, but there it is. (No, we haven't logged a TAR yet -- whatever that is -- partly because it didn't occur to us and partly because we only recently came across the issue and sensibly want to do some testing before we cry foul.)
    However, the code is pretty straight-forward, much like this (inside a FOR EACH ROW trigger body):
    SELECT <seqname>.NEXTVAL INTO <keyvar> FROM DUAL;
    INSERT INTO <tblname> (<keyfield>, <... some other fields>)
    VALUES(<keyvar>, <... some other values> );
    (where <tblname> is NOT the table on which the trigger is fired). This is the only place where the sequence is ever accessed. The sequence state is way below its limits (either MAXVALUE or <keyfield>/<keyvar> datatype size).
    In this setup, end users sometimes got an out-of-the-blue SQL error to the effect that uniqueness constraint has been violated -- as I said, we used to have a unique index on <keyfield> -- which leads us to assume that the sequence generated a duplicate key (only way for the constraint to be violated, AFAIK). We released the constraint and indeed, using a simple SELECT <keyfield>, COUNT(*) FROM <tblname> GROUP BY <keyfield> HAVING COUNT(*)>1 got us some results.
    Unfortunately, the <tblname> table gets regularly purged by a consumer process so it's hard to trace; now we created a logger trigger, on <tblname> this time, which tracks cases of duplicate <keyfield> inserts... We'll see how it goes.
    @Laurent... winks at the CYCLE thing Our sequence is (needless to say) declared as NOCYCLE and the datatype is large enough to hold MAXVALUE.

  • Passing different (multi-) values for parameters to drill-through report, based on clicked subtotal in main report

    In Report Builder 3.0, I have made a main report in which the user can filter the underlying dataset using three parameters (all multi-value). The report shows totals grouped by these three parameters, as well as a grand total. What I want is to click
    on a total, which then opens the drill-through report for the corresponding records. I have achieved this for the grand total; the action in the corresponding text box passes all selected values of the parameters to the drill-through report.
    What I cannot figure out is how to make this work right when clicking on a subtotal. When I use the same expression as for the grand total, the same values for the parameters are passed, instead of the subset that apply to the corresponding text box in the
    main report. I expected this to work, because Report Builder /does/ correctly calculate the SUMs for the different levels, even though the expressions are the same.
    My question is: how do I pass different drill-through (multi-) values for parameters, corresponding to the respective subtotals in the main report?
    (FYI: I am using Microsoft SQL Server 2008 R2 and Report Builder 3.0 .)

    Hello Katherine,
    Thanks once more for your quick reply.
    I was aware of the textbox action "Go to report", and how to pass parameters in general. My question concerned how to determine the scope of the passed multi-value parameters (to the values that apply to the respective group/subtotal). The article you linked
    to is informative, but not a solution to my problem.
    A colleague of mine came up with a pragmatic solution: instead of trying to determine the scope of the parameter values, now I "look to the left in the results table". The two screenshots below should illustrate this. (Screenshots are in Dutch. Specific information
    is pixelated.)
    Unfortunately, I am not able to post images. Once my account is verified, I will edit them in. For now, I hope the text speaks for itself enough.
    [Screenshot: Drill-through parameters - 01: Report Builder tablix with subtotals]
    [Screenshot: Drill-through parameters - 02: Textbox properties (selected in screenshot 01) - Action - Go to report]
    The first screenshot shows the tablix in the Report Builder. The second screenshot shows the properties of the textbox selected in the first.
    Notice that I do not pass parameters for the first two columns, but the actual values. I only pass the parameter (containing /all/ user-selected values) for the third column. In the textbox below the selected one, I pass the actual values for the first column,
    and parameters for the last two. In the textbox above the selected one, I pass the actual values for all three columns.
    The only (cosmetic) flaw this approach has is that in the drill-through report, the list of selected parameters might show values that do not occur in the (corresponding part of the) results, and only for those parameters for which the main report passes (all
    user-selected) parameter values, and not the actual values in the results. The results are correct, though.
    If there is a way to directly determine the scope of multi-value parameters for passing to a drill-through report, I would still like know. But for now, this seems to work.

  • How to catch BCD_OVERFLOW error when passing value to formal parameter?

    Hi,
    catching runtime error BCD_OVERFLOW exception is simple. However, it's not possible to catch this error directly, if it results from assigning too big value to the formal parameter.
    Let's assume simple code with local class lcl_calculator implementing functional method add with two input parameters i_op1 and i_op2 both of type i and result value r_result of type i as well.
    The following code dumps, without the exception being caught:
    DATA:
       lo_calculator TYPE REF TO lcl_calculator,
       l_result TYPE i.
    START-OF-SELECTION.
       TRY.
           CREATE OBJECT lo_calculator.
           l_result = lo_calculator->add(
             i_op1 = 10000000000
             i_op2 = 1 ).
           WRITE:/ l_result.
         CATCH cx_sy_conversion_overflow.
           WRITE:/ 'Error'.
       ENDTRY.
    To solve this, the workaround has to be implemented with checking the values being passed to the method before the actual call is made:
    DATA:
       lo_calculator TYPE REF TO lcl_calculator,
       l_result TYPE i,
       l_op1 TYPE i,
       l_op2 TYPE i.
    START-OF-SELECTION.
       TRY.
           l_op1 = 10000000000.
           l_op2 = 1.      
           CREATE OBJECT lo_calculator.
           l_result = lo_calculator->add(
             i_op1 = l_op1
             i_op2 = l_op2 ).
           WRITE:/ l_result.
         CATCH cx_sy_conversion_overflow.
           WRITE:/ 'Error'.
       ENDTRY.
    It's the same with the function module call, so it's general unit interface issue. Also, using the exception handling related to the CALL METHOD command does not help here as it's not wrong parameter TYPING which causes the error. It's the VALUE of correctly typed parameter that causes the error.
    The CATCH apparently reacts different ways when the assignment is made to the variable and to the formal parameter of the unit. Any idea how to solve the above without using that workaround?
    Thank you
    Michal

    What about using numeric?
    CLASS lcl_calculator DEFINITION.
       PUBLIC SECTION.
         METHODS add IMPORTING i_op1 TYPE numeric i_op2 TYPE numeric RETURNING value(r_sum) TYPE i
                      RAISING cx_sy_conversion_overflow.
    ENDCLASS.                    "lcl_calculator DEFINITION
    CLASS lcl_calculator IMPLEMENTATION.
       METHOD add.
         TRY.
             r_sum = i_op1 + i_op2.
           CATCH cx_sy_arithmetic_overflow.
             RAISE EXCEPTION TYPE cx_sy_conversion_overflow.
         ENDTRY.
       ENDMETHOD.                    "add
    ENDCLASS.                    "lcl_calculator IMPLEMENTATION
    DATA:
        lo_calculator TYPE REF TO lcl_calculator,
        l_result TYPE i.
    START-OF-SELECTION.
       TRY.
           CREATE OBJECT lo_calculator.
           l_result = lo_calculator->add(
             i_op1 = 10000000000
             i_op2 = 1 ).
           WRITE:/ l_result.
         CATCH cx_sy_conversion_overflow.
           WRITE:/ 'Error'.
       ENDTRY.

  • Script fails when passing values from pl/sql to unix variable

    Script fails when passing values from pl/sql to unix variable
    Dear All,
    I am Automating STATSPACK reporting by modifying the sprepins.sql script.
    Using DBMS_JOB I take the snap of the database and at the end of the day the cron job creates the statspack report and emails it to me.
    I am storing the snapshot ids in the database and when running the report picking up the recent ids(begin snap and end snap).
    From the sprepins.sql script
    variable bid number;
    variable eid number;
    begin
    select begin_snap into :bid from db_snap;
    select end_snap into :eid from db_snap;
    end;
    This fails with the following error:
    DB Name DB Id Instance Inst Num Release Cluster Host
    RDMDEVL 3576140228 RDMDEVL 1 9.2.0.4.0 NO ibm-rdm
    :ela := ;
    ERROR at line 4:
    ORA-06550: line 4, column 17:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    ( - + case mod new not null &lt;an identifier&gt;
    &lt;a double-quoted delimited-identifier&gt; &lt;a bind variable&gt; avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    &lt;a string literal with character set specification&gt;
    &lt;a number&gt; &lt;a single-quoted SQL string&gt; pipe
    The symbol "null" was substituted for ";" to continue.
    ORA-06550: line 6, column 16:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    ( - + case mod new not null &lt;an identifier&gt;
    &lt;a double-quoted delimited-identifier&gt; &lt;a bind variable&gt; avg
    count current exists max min prior sql stddev su
    But when I change the select statements below the report runs successfully.
    variable bid number;
    variable eid number;
    begin
    select '46' into :bid from db_snap;
    select '47' into :eid from db_snap;
    end;
    Even changing the select statements to:
    select TO_CHAR(begin_snap) into :bid from db_snap;
    select TO_CHAR(end_snap) into :eid from db_snap;
    Does not help.
    Please Help.
    TIA,
    Nischal

    Hi,
    could it be the begin_ and end_ Colums of your query?
    Seems SQL*PLUS hs parsing problems?
    try to fetch another column from that table
    and see if the error raises again.
    Karl

  • Dynamic sql reurns no data when multiple values are passed.

    (Dynamic sql returns no data when multiple values are passed.)
    Hi,
    While executing the below dynamic sql in the procedure no data is returned when it has multiple input values.
    When the input is EMPID := '1'; the procedure works fine and returns data.Any suggestion why the procedure doen't works when input as EMPID := '1'',''2'; is passed as parameter?
    =======================================================
    create or replace PROCEDURE TEST(EMPID IN VARCHAR2, rc OUT sys_refcursor)
    IS
    stmt VARCHAR2(9272);
    V_EMPID VARCHAR2(100);
    BEGIN
    V_EMPID :=EMPID;
    stmt := 'select * from TEST123 where Empid is NOT NULL';
    IF V_EMPID <> '-1' THEN
    stmt := stmt || ' and Empid in (:1)';
    ELSE
    stmt := stmt || ' and -1 = :1';
    END IF;
    OPEN rc FOR stmt USING V_EMPID;
    END Z_TEST;
    ============================================================
    Script for create table
    ==================================================================
    CREATE TABLE TEST123 (
    EMPID VARCHAR2(10 BYTE),
    DEPT NUMBER(3,0)
    ===========================================
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('1',20);
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('2',10);
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('3',30);
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('3',30);
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('2',10);
    =============================================
    Select * from TEST123 where Empid in (1,2,3)
    EMPID DEPT
    1     20
    2     10
    3     30
    3     30
    2     10
    ===================================================================
    Any suggestion why the procedure doen't works when input EMPID := '1'',''2';?
    Thank you,

    The whole scenario is a little strange. When I tried to compile your procedure it couldn't compile, but I added the missing info and was able to get it compiled.
    create or replace PROCEDURE TEST (EMPID IN VARCHAR2, rc OUT sys_refcursor)
    IS
      stmt        VARCHAR2 (9272);
      V_EMPID     VARCHAR2 (100);
    BEGIN
      V_EMPID := EMPID;
      stmt := 'select * from TEST123 where Empid is NOT NULL';
      IF V_EMPID = '-1' THEN
        stmt := stmt || ' and Empid in (:1)';
      ELSE
        stmt := stmt || ' and -1 = :1';
      END IF;
      OPEN rc FOR stmt USING V_EMPID;
    END;If you pass in 1 as a parameter, it is going to execute because the statement that it is building is:
    select * from TEST123 where Empid is NOT NULL and -1 = 1Although the syntax is valid -1 will never equal 1 so you will never get any data.
    If you pass in 1,2 as a parameter then it is basically building the following:
    select * from TEST123 where Empid is NOT NULL and -1 = 1,2This will cause an invalid number because it is trying to check where -1 = 1,2
    You could always change your code to:
    PROCEDURE TEST (EMPID IN VARCHAR2, rc OUT sys_refcursor)
    IS
      stmt        VARCHAR2 (9272);
      V_EMPID     VARCHAR2 (100);
    BEGIN
      V_EMPID := EMPID;
      stmt := 'select * from TEST123 where Empid is NOT NULL';
      stmt := stmt || ' and Empid in (:1)';
      OPEN rc FOR stmt USING V_EMPID;
    END;and forget the if v_empid = '-1' check. If you pass in a 1 it will work, if you pass in 1,2 is will work, but don't pass them in with any tick marks.

Maybe you are looking for