Setting Page Items from SQL Query

Hi, </br></br>
I am using "SQL Query (PL/SQL function body returning SQL query)" for a report. In the body of the sql query, after calling a function, I have the following statement: </br></br>
APEX_UTIL.SET_SESSION_STATE( p_name => 'P13_MESSAGE', p_value => 'Contact Tech Support' ); </br></br>
and I find that I cannot save the query. I get an error message: </br></br>
<b>Unexpected error, unable to find item name at application or page level.
ERR-1002 Unable to find item ID for item "P13_MESSAGE" in application "4000". </b>
</br></br>
I do have the field 'P13_MESSAGE' on my page. </br></br>
Can't this API call be used within such a query type? Is there an alternative to this? </br></br>
Thanks in advance </br></br>
Vasan

Scott,</br></br>
I have given the source of the region, below. Its type is 'SQL Query (PL/SQL Function body Returning SQL Query'). </br></br>
"Get_State_Hit" is a procedure in a package. I have not shown the name of the package here.</br></br>
Please give me your suggestion. </br></br> Thanks </br></br> Vasan </br></br>
========= </br></br>
DECLARE </br>
l_sql varchar2(100); </br>
BEGIN <br>  
IF(:P13_MATCH_TYPE = 'ALL') THEN</br>
    Get_State_Hit ( one set of values from user-interface );</br>
    apex_util.set_session_state( p_name => 'P13_MESSAGE', p_value => ' MsgString 1' );</br>
ELSE</br>
    Get_State_Hit ( another set of values from user-interface );</br>
    apex_util.set_session_state( p_name => 'P13_MESSAGE', p_value => ' MsgString 2' );</br>
END IF; </br>
l_sql := 'Select Col 1, Col 2, ..., Col 9 from ABC_Vw'; </br>
RETURN l_sql;</br>
EXCEPTION</br>
WHEN OTHERS THEN</br>
l_sql := 'Select * from Default_Vw' ;</br>
apex_util.set_session_state(p_name => 'P13_MESSAGE', p_value => 'Contact Tech Support');</br>
RETURN l_sql; </br>
END;</br></br>
==========</br></br>
Message was edited by:
Vasan

Similar Messages

  • Set page item from a stored procedure

    Dear reader
    We would like to have a stored procedure to run every 10 minutes. When the procedure starts, the user has to be warned that the update process is running.
    When the procedure is finished, the user should receive a message that the update process is finished.
    What I had in mind was to set a Page 0 item 'P0_REFRESH' and set his value depending on the status of the update. Then add a dynamic action with a change event. So everytime the value of this page item changes, the user will receive a correct message.
    Does anyone know if it is possible to set a page item from a stored procedure?
    Kind regards
    Xnni

    AndyPol
    I found a solution by querying the user_jobs table. In Apex, I created two page 0 items that hold the current status of the job (online, offline) and the old value of the job.
    Online of offline in the current status item is determined by a decode on "this_sec".
    The enext step was to include a html region in P0 that contains some javascript. This javascript will display a message when the values of the new status is different from the old status ;)
    Many thanks for bringing up the ideas.
    Greetz
    Xnni

  • Setting page items from Stored Procedure/Package

    Hi,
    Can anyone tell me if it is possible to set the values of page items from stored pl/sql code. I have some reasonably complex biz logic that I want to package and store in the database (not just call an anonymous pl/sql block through a page process). However within that stored code I want to set items on my page based on input parameters, other items on the page or calculations eg.
    I want to do something like:
    :P6_INT_ACC_START_DT := p_bony_auction_dt + 1;
    when trying to compile this code I get invalid bind variable error
    I also tried:
    V('P6_INT_ACC_START_DT') := p_bony_auction_dt + 1;
    but got invalid use of V function error
    Any ideas?
    Thanks, Robert

    Call apex_util.set_session_state:
    apex_util.set_session_state(p_name => 'P6_INT_ACC_START_DT', p_value => p_bony_auction_dt + 1);
    ...although be aware of date-to-varchar2 conversion and use date format masks explicitly.
    Scott

  • Setting Page Item from Hyperlink

    Hi,
    I am currently developing an APEX application that will show a Google map of our kiosk locations. It builds the javascript in a PL/SQL package using htp.print. For each marker it displays for the kiosk, I'm customizing the info window displayed when the marker is clicked to show the kiosk name, the address and some hyperlinks. One of these hyperlinks will go to another APEX page that displays orders for that kiosk. So, what I'm trying to accomplish is to set a page item value on the page when the hyperlink is clicked that will be used in a page query to pull the orders. I am not much of a javascript programmer, so I'm having some issues. Here is what i'm currently attempting:
    Withiin the FOR loop that builds my markers, I have defined a 'function' as follows:
    htp.print('function setKioskCode (P4_KIOSK_CODE) {');
    htp.print('var kioskcode = '||''''||<location from cursor loop>||''''||';');
    htp.print('$x('||''''||'P4_KIOSK_CODE'||''''||').value = kioskcode;');
    htp.print('}');Then, this is how I'm building the hyperlink in the info window (i've removed the link tags and single quotes so I could post the code). Using this method, I get an error on the load of the map page that says ' Expected ")" '. I can't find any syntax errors in what i have done from what I can tell (I could definitely be wrong!).
    l_order_link := href="f?p='||v('APP_ID')||':6:'||v('SESSION')||'" onclick="javascript:setKioskCode('||''''||'P4_KIOSK_CODE'||''''||');">OrdersWhen I remove the parameter value from the javascript call like this. It loads the map successfully, but, of course, the hyperlink on the marker info window doesn't work.
    l_order_link := href="f?p='||v('APP_ID')||':6:'||v('SESSION')||'" onclick="javascript:setKioskCode();">OrdersAny help would be much appreciated. And please let me know if you need any further info.
    Thanks,
    Troy
    Edited by: tfitz on Oct 21, 2010 1:53 PM

    Thanks for the reply, Jari.
    I have determined you definitely have to use the v('APP_ID') and v('SESSION') in the href statement. Otherwise, it puts the &APP_ID. and &APP_SESSION. in the URL.
    I tried the 'onclick' syntax you provided and it still does not work. I get the error I reported above. It's looking for the closing parenthesis and doesn't like a parameter being provided. If i remove the parameter from the function, the page loads and the hyperlink goes to the proper page but it doesn't populate the page item. I don't know why it doesn't like a parameter for the function.
    Thanks, Troy.

  • Set Text Item To SQL Query Result

    I am trying to set a text item to a SQL query result. Something like the following:
    (I am trying to accomplish this in the SOURCE portion, set to 'SQL Query' source type, of the text item properties)
    SELECT empno FROM emp WHERE empno = :SEARCH_EMPNO;
    This only displays as the literal text when the application renders and not the value from the SQL query.
    I apologize if this has already been posted but I could not find what I am looking for. I have seen posts that reference a pre-region computation but do not know the exact steps to accomplish the results I want.
    Thanks in advance for anyone's time to help me with my issue.
    Kyle

    Scott,
    The literal that displayed (I have fixed it) was the actual SQL statement: SELECT empno FROM emp WHERE empno = :SEARCH_EMPNO;
    I have resolved the issue, using SQL Query as the "Source Type" and Always, replacing any existing value in session state as the "Source Used" for the properties of the item.
    What I was trying to accomplish is a search text item that would return the data for that record in a table into other text items, for each column in that record, for update; based on the search text item as a unique SQL query search for that record.
    Thank you for your quick reply!
    Kyle

  • Report from SQL Query -Excel format only show the first page

    Hi,
    I have some Reports from SQL Query. In the display options, I choose Excel as default format. The Excel documents only show the first page. If I choose HTML as default format, it shows every rows.
    Please advise on how to have a complete Excel document as HTML format does.
    Thanks a lot.
    Lina Han

    I beleive when you export Oracle reports to Excel it is the Data that is transferred along with Column Names.
    You cannot export the variables defined on the report.
    Hence you will not be able to export the Footer to excel. (Still looking into it will let you know if i find anything interesting)
    Regards,
    Bhushan Salgar

  • Query based Report (Reports From SQL Query)

    Hi All,
    I am facing a problem with a report. I need your help.
    I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
    If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
    Can i increase a timeout of portal page, how i can do this?
    The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
    Please help me to find appropriate reasone for the failure?

    Can you post the URL that is giving you the page not found error ? I am not sure if I can be of much help though.
    In order to increase your chances to get a reply you should also post your question in the Portal Forum - Oracle Application Server Portal
    Edited by: Rodolfo Ferrari on Jun 16, 2009 3:49 PM

  • Need help in Report From SQL Query

    Hi All,
    I am facing a problem with a report. I need your help.
    I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
    If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
    I tried also increase the page time out in httpd.conf, but no use.
    The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
    Please help me to find appropriate reasone for the failure?

    user602513 wrote:
    Hi All,
    I am facing a problem with a report. I need your help.
    I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
    If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
    I tried also increase the page time out in httpd.conf, but no use.
    The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
    Please help me to find appropriate reasone for the failure?Do you get any errors or warnings or it is just the slow speed which is the issue?
    There could be a variety of reasons for the delayed processing of this report. That includes parameter settings for that page, cache settings, network configurations, etc.
    - explore best optimization for your query;
    - evaluate portal for best performance configuration; you may follow this note (Doc ID: *438794.1* ) for ideas;
    - third: for that particular page carrying that report, you can use caching wisely. browser cache is neither decent for large files, nor practical. instead, explore the page cache settings that portal provides.
    - also look for various log files (application.log and apache logs) if you are getting any warnings reflecting on some kind of processing halt.
    - and last but not the least: if you happen to bring up a portal report with more than 10000 rows for display then think about the usage of the report. Evaluate whether that report is good/useful for anything?
    HTH
    AMN

  • Can I declare variables in Reports from SQL Query

    Hi
    I have a Report from SQL Query published as a portlet on a page among other reports. In the query report I am using the fuction WWCTX_API.GET_USER at quite a few places to filter the data returned to the user. Can I assingn the user id to a variable at some level & replace the fuction WWCTX_API.GET_USER with the variable in all the places.
    For eg:
    usr varchar2(25);
    usr:= PORTAL30.WWCTX_API.GET_USER;
    select USER_ID, USER_LVL, BUSINESS_ID, BRANCH_ID from crs_user where user_id=usr;
    can i declare variable and assign the value like the above at any level(Report or Page Level) to the acces the variale in queries.
    Thanks in advance

    I have found that you can't use a * in a dynamic page.
    Try this:
    <ORACLE>
    DECLARE
    usr varchar2(25):=PORTAL30.WWCTX_API.GET_USER;
    BEGIN
    for c in
    (SELECT <column_name> <alias> FROM PORTALWORK.CRS_USER WHERE USER_ID=usr)
    Loop
    htp.p(c.<alias>);
    END;
    </ORACLE>
    You can also add table tags for column formating:
    <table>
    <tr><td>column 1</td></tr><tr><td nowrap>
    <ORACLE>
    DECLARE
    usr varchar2(25):=PORTAL30.WWCTX_API.GET_USER;
    BEGIN
    for c in
    (SELECT <column_name> <alias> FROM PORTALWORK.CRS_USER WHERE USER_ID=usr)
    Loop
    htp.p(c.<alias>);
    END;
    </ORACLE>
    </td></tr></table>
    Martin

  • Adding update and delete buttons to a  Report from SQL Query

    There is an option when creating a QBE to add update and delete
    links which i find quite useful, but this option doesn't seem to
    be possible on a Report from SQL Query. Do i need to do
    something special to add them? is the option located in a
    different place?

    Hi,
    You can only add Update ,Delete in QBE Reports,
    there is no option in Portal which can be used to
    have these buttons in the Reports from Query Wizard or
    Report from SQL Query.
    Thanks
    Vineet

  • Getting zero-sized reply error when running report from SQL query

    Hi,
    I have a Report from SQL Query in Portal. When I select Excel in Output Format and then run the report, it works properly, but when I select HTML in Output Format, the report works if the rows returned are not so many (I've been able to display the report for up to 701 rows), but when I try selecting a value from the LOV that selects many rows, I get the following error:
    ERROR
    The requested URL could not be retrieved
    While trying to retrieve the URL: <data suppressed>
    The following error was encountered:
    Zero Sized Reply
    Squid did not receive any data for this request.
    Any ideas on how to fix this? Why does the number of rows returned affect the report this way?
    Thanks,
    Lorena

    Problem comes when any of the filter is applied in any one of the cases selected from the GUI.Do you mean that the problems only shows when you run the report in your browser via 9iAS?
    Which version are you using?
    Can you post the before report trigger?

  • Getting Zero Sized Reply error in report from SQL query

    Hi,
    I have a Report from SQL Query in Portal 3.0.9. When I select Excel in Output Format and then run the report, it works properly, but when I select HTML in Output Format, the report works if the rows returned are not so many (I've been able to display the report for up to 701 rows), but when I try selecting a value from the LOV that selects many rows, I get the following error:
    ERROR
    The requested URL could not be retrieved
    While trying to retrieve the URL: <data suppressed>
    The following error was encountered:
    Zero Sized Reply
    Squid did not receive any data for this request.
    Any ideas on how to fix this? Why does the number of rows returned affect the report this way?
    Thanks,
    Lorena

    Hi,
    I have a Report from SQL Query in Portal 3.0.9. When I select Excel in Output Format and then run the report, it works properly, but when I select HTML in Output Format, the report works if the rows returned are not so many (I've been able to display the report for up to 701 rows), but when I try selecting a value from the LOV that selects many rows, I get the following error:
    ERROR
    The requested URL could not be retrieved
    While trying to retrieve the URL: <data suppressed>
    The following error was encountered:
    Zero Sized Reply
    Squid did not receive any data for this request.
    Any ideas on how to fix this? Why does the number of rows returned affect the report this way?
    Thanks,
    Lorena

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • Width of field in Report From SQL Query

    I have created a report from SQL query with 15 columns being selected. However, no matter what column width and column type (pixel, char, percent) I enter in the column formatting tab of the report, I cannot get the report to format the column to the width I desire. It is always a fixed width. Does anyone have any suggestions?
    Thanks,
    Martin

    Hi,
    Char (used for ASCII format)
    Displays the output in the specified number of
    characters per line. For example, if you enter 20
    in Width, the report displays 20 characters of the
    column data in each line. If the number of
    characters per line exceeds the specified
    number, the remaining characters are wrapped
    to the next line.
    Pixel
    Displays the output in the specified number of
    pixels per row. For example, if you enter 10 in
    Width, the column data displays 10 pixels of
    data per line of the displayed table.
    Percent
    Displays the output in the specified percentage
    of the table. For example, if you enter 25 in
    Width, the column data displays in 25% of the
    displayed table.
    Thanks,
    Sharmila

  • Can Portal Report from SQL Query use where column IN (:bind_variable)

    I would like to create a portal report from sql query with IN (:bind_variable) in the where clause. The idea is that the user would enter comma-separated or comma-quote-separated values for the bind_variable. I have tried this several ways but nothing seems to work. Can this be done?
    Trenton

    Hi,
    Which version of portal are you using. This is a bug. It has been fixed in 30984.
    Thanks,
    Sharmila

Maybe you are looking for