Dynamic LOV giving error

Hi ,
I have a dynamic LOV like this
IF :P1_IND_MGR = 'I' THEN
RETURN
'SELECT DISTINCT(first_name||' '||last_name) a ,
(first_name) b
FROM MIS_CDR_HR_EMPLOYEES_MV
ORDER BY 1';
ELSE
RETURN
'SELECT DISTINCT(manager_name) a ,
manager_name b
FROM MIS_CDR_HR_EMPLOYEES_MV
ORDER BY manager_name';
END IF;
When I run the application I get an error message like this , and its due to concatinating a space between first_name and last_name. How can I get the desired results ?
" ORA-06550: line 3, column 34: PLS-00103: Encountered the symbol "||last_name) a , (first_name) b FROM MIS_CDR_HR_" when expecting one of the following: . ( * @ % & = - + ; < / > at in is mod remainder not rem <> or != or ~= >= <= <> and or like between || multiset member SUBMULTISET_ The symbol "." was substituted for "||last_name) a , (first_name) b FROM MIS_CDR_HR_" to continue.

I think you need extra sinble quotes around your space in the first line:
'SELECT DISTINCT(first_name||'' ''||last_name) a ,
Jon.

Similar Messages

  • Dynamic sql giving error --please help

    Hi ,
    I have written the following code --
    CREATE OR REPLACE FUNCTION tabcount (
    tab IN VARCHAR2, field IN VARCHAR2 ,whr IN VARCHAR2)
    RETURN INTEGER
    IS
    retval INTEGER;
    BEGIN
    DBMS_OUTPUT.PUT_LINE ('whr' ||whr);
    DBMS_OUTPUT.PUT_LINE ('field1' ||field);
    EXECUTE IMMEDIATE
    ' SELECT COUNT(*) FROM ' || tab ||
    ' WHERE ' || field || 'like '/'%'||whr ||'%'/''
    INTO retval;
    DBMS_OUTPUT.PUT_LINE ('countis!' ||retVal);
    RETURN retval;
    END tabcount;
    It is giving the following error--
    ORA-00920: invalid relational operator
    ORA-06512: at "TABCOUNT", line 10
    ORA-06512: at line 2
    I am not sure how to enclose the like operator within the single quotes.Double quotes is not working for me.
    Thanx in advance,
    Ira

    Offhand, it looks like you may still have some syntax problems -- probably need a blank space before the WHERE --maybe some other stuff too.
    What you need to do to debug it is this (and this works just about anytime you are having trouble with dynamic SQL):
    1. store the sql statement in a variable.
    2. Use DBMS_OUTPUT to display your select statement BEFORE calling execute immediate.
    3. copy/paste that select into a separate window and run/debug it.
    4. Once you know what is wrong with that statement, go back and fix the code accordingly.
    Have fun,
    --scott                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Dynamic Sql giving error

    Hi,
    I am creating a BIP report and it is giving an issue on generating Data XML in OTM application.
    The Report XML is simple query and taking input parameter for shipment_gid, the parameter is handled in SET_LEXICAL_PARAMETER to add where clause and append “=” with the passed value of parameter &P_SHIPMENT_GGID.
    When I try to generate data XML in Query template, it is giving below error
    java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
    I have tried to change parameter in many ways in SET_LEXICAL_PARAMETERS, but still getting error. Please check the XML and package and advice.
    XML
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <dataTemplate name="pri_sec_ocean_fcl_booking_view" defaultPackage="pri_sec_ocean_fcl_booking_view" version="1.0">
    <properties>
    <property name="xml_tag_case" value="upper" />
    </properties>
    <parameters>
    <parameter name="P_GL_USER" dataType="character" defaultValue="ULE.ADMIN" />
    <parameter name="P_ROLE_ID" dataType="character" defaultValue="ADMIN" />
    <parameter name="P_L_SHIPMENT_GGID" dataType="character" defaultValue="1=1" />
    </parameters>
    <lexicals />
    <dataQuery>
    <sqlStatement name="Q_1">
    <![CDATA[SELECT
                             CT.FIRST_NAME||' '||CT.LAST_NAME||' Email '||CT.EMAIL_ADDRESS||'PHONE1 '||CT.PHONE1||'PHONE2 '||CT.PHONE2 BOOKER_ID
                   FROM      SHIPMENT_INVOLVED_PARTY SH,
                             CONTACT CT
                             &P_L_SHIPMENT_GGID
                   AND        SH.INVOLVED_PARTY_QUAL_GID               =     'CARRIER_BOOKING_OFFICE'
                   AND          SH.INVOLVED_PARTY_CONTACT_GID          =     CT.CONTACT_GID
       ]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="afterParameterFormTrigger" source="pri_sec_ocean_fcl_booking_view.afterpform" />
    <dataTrigger name="beforeReportTrigger" source="pri_sec_ocean_fcl_booking_view.beforereport" />
    <dataStructure>
    <element name="P_L_SHIPMENT_GGID" dataType="varchar2" value="pri_sec_ocean_fcl_booking_view.P_L_SHIPMENT_GGID" />
    <group name="G_1" dataType="varchar2" source="Q_1">
    <element name="BOOKER_ID" dataType="varchar2" value="BOOKER_ID"/>
    </group>
    </dataStructure>
    <dataTrigger name="afterReportTrigger" source="pri_sec_ocean_fcl_booking_view.afterreport()" />
    </dataTemplate>
    Package
    create or replace PACKAGE pri_sec_ocean_fcl_booking_view IS
    DESNAME VARCHAR2(200);
    DESTYPE VARCHAR2(100);
    DESFORMAT VARCHAR2(200):='PDF';
    P_GL_USER VARCHAR2(128);
    P_ROLE_ID VARCHAR2(1000);
    P_DATABASE_CONN_STRING VARCHAR2(50);
    P_FILE VARCHAR2(100);
    P_PDF_HYPERLINK VARCHAR2(1000);
    P_REPORT_GID VARCHAR2(101);
    P_XML_HYPERLINK VARCHAR2(1000);
    P_DOMAIN VARCHAR2(50);
    P_KEEP_FILE_FLAG VARCHAR2(1);
    P_LANGUAGE_ID VARCHAR2(30);
    P_RPT_JOB NUMBER;
    P_FORMAT VARCHAR2(40);
    P_DATE_FORMAT VARCHAR2(15);
    P_TIME_FORMAT VARCHAR2(32767);
    P_REPORT_CALL VARCHAR2(1000);
    P_GLOG_USER VARCHAR2(30);
    P_GLOG_USER_PASS VARCHAR2(30);
    P_REPORT_PHYSICAL_NAME VARCHAR2(100) := 'PRI_SEC_OCEAN_FCL_BOOKING_VIEW';
    P_WITHIN_REPORT VARCHAR2(1);
    P_REPORTS_OUT_DIR VARCHAR2(100);
    P_REPORTS_SERVER VARCHAR2(100);
    P_SHIP_START_RANGE DATE;
    P_SHIP_END_RANGE DATE;
    P_GROUP_BY VARCHAR2(2000);
    P_REP_USERID VARCHAR2(100);
    P_L_SHIPMENT_GGID VARCHAR2(32766) := '1=1';
    P_L_CONTAINER_NUMBER_WHERE VARCHAR2(32766) := '1=1';
    P_H_CONTAINER_NUMBER VARCHAR2(32766);
    FUNCTION P_FORMATVALIDTRIGGER(DESTYPE IN VARCHAR2) RETURN BOOLEAN;
    FUNCTION BEFOREREPORT RETURN BOOLEAN;
    FUNCTION AFTERREPORT RETURN BOOLEAN;
    FUNCTION BEFOREPFORM RETURN BOOLEAN;
    FUNCTION AFTERPFORM RETURN BOOLEAN;
    FUNCTION P_SHIP_END_RANGEVALIDTRIGGER RETURN BOOLEAN;
    FUNCTION VALUE_ENTERED(LEX_NAME IN VARCHAR2) RETURN BOOLEAN;
    PROCEDURE SET_LEXICAL_PARAMETERS;
    END PRI_SEC_OCEAN_FCL_BOOKING_VIEW;
    create or replace
    PACKAGE BODY PRI_SEC_OCEAN_FCL_BOOKING_VIEW IS
    FUNCTION P_FORMATVALIDTRIGGER(DESTYPE IN VARCHAR2) RETURN BOOLEAN IS
    BEGIN
    IF DESTYPE = 'Cache' AND P_WITHIN_REPORT = 'N' THEN
    IF P_FORMAT = 'View PDF' THEN
    DESFORMAT := 'PDF';
    ELSIF P_FORMAT = 'View HTML' THEN
    DESFORMAT := 'HTMLCSS';
    END IF;
    END IF;
    RETURN (TRUE);
    END P_FORMATVALIDTRIGGER;
    FUNCTION BEFOREREPORT RETURN BOOLEAN IS
    BEGIN
    REPORTS_LIBRARY.SET_VPD(P_GL_USER);
    /*SRW.SET_BEFORE_REPORT_HTML(SRW.TEXT_ESCAPE
    ,BUILD_HTML_HEADER)*/NULL;
    /*SRW.SET_AFTER_REPORT_HTML(SRW.TEXT_ESCAPE
    ,BUILD_HTML_FOOTER(P_REPORT_GID
    ,P_LANGUAGE_ID))*/NULL;
    RETURN (TRUE);
    END BEFOREREPORT;
    FUNCTION AFTERREPORT RETURN BOOLEAN IS
    BEGIN
    REPORTS_LIBRARY.SET_VPD(P_GL_USER);
    IF DESTYPE = 'File' THEN
    RPT_GENERAL.P_INSERT_LOG(P_FILE
    ,P_REPORT_GID
    ,P_RPT_JOB
    ,P_GL_USER
    ,P_DOMAIN);
    END IF;
    RETURN (TRUE);
    END AFTERREPORT;
    FUNCTION BEFOREPFORM RETURN BOOLEAN IS
    BEGIN
    REPORTS_LIBRARY.SET_VPD(P_GL_USER);
    /*SRW.SET_AFTER_FORM_HTML(SRW.TEXT_ESCAPE
    ,BUILD_AFTER_FORM_HTML)*/NULL;
    RETURN (TRUE);
    END BEFOREPFORM;
    FUNCTION AFTERPFORM RETURN BOOLEAN IS
    V_STRING VARCHAR2(32750);
    WS_DATE VARCHAR2(30);
    V_BOOLEAN BOOLEAN;
    BEGIN
    REPORTS_LIBRARY.SET_VPD(P_GL_USER);
    V_BOOLEAN := REPORTS_LIBRARY.GET_USER_PREFERENCES(P_GL_USER,P_ROLE_ID
    ,P_DATE_FORMAT
    ,P_TIME_FORMAT
    ,P_LANGUAGE_ID);
    V_STRING := RTRIM(REPORTS_LIBRARY.BUILD_LOCALIZATION_STRING(P_REPORT_GID
    ,P_LANGUAGE_ID));
    /*SRW.APPLY_DEFINITION*/NULL;
    IF P_KEEP_FILE_FLAG = 'Y' THEN
    WS_DATE := '_' || TO_CHAR(SYSDATE
    ,'YYMMDDHHMI');
    END IF;
    P_FILE := LOWER(TRANSLATE(TRANSLATE(P_DOMAIN || '_' || P_REPORT_GID
    ,'_') || P_RPT_JOB || WS_DATE || '.' || DESFORMAT);
    DESNAME := LOWER(P_REPORTS_OUT_DIR || '/' || P_FILE);
    /*SRW.GET_REPORT_NAME(P_REPORT_PHYSICAL_NAME)*/NULL;
    P_REPORT_PHYSICAL_NAME := RTRIM(P_REPORT_PHYSICAL_NAME);
    P_PDF_HYPERLINK := P_REPORT_CALL || '?' || P_REP_USERID || ' server=' || P_REPORTS_SERVER || ' report=' || P_REPORT_PHYSICAL_NAME || ' destype=CACHE desformat=PDF p_gl_user=' || P_GL_USER || ' p_within_report=Y' || ' P_REPORT_GID=' || P_REPORT_GID || ' p_l_time_period=' || ' p_l_named_range=' || ' p_rep_userid=' || P_REP_USERID;
    P_XML_HYPERLINK := P_REPORT_CALL || '?' || P_REP_USERID || ' server=' || P_REPORTS_SERVER || ' report=' || P_REPORT_PHYSICAL_NAME || ' destype=CACHE desformat=XML p_gl_user=' || P_GL_USER || ' p_within_report=Y' || ' P_REPORT_GID=' || P_REPORT_GID || ' p_l_time_period=' || ' p_l_named_range=' ||' p_rep_userid=' || P_REP_USERID;
    SET_LEXICAL_PARAMETERS;
    RETURN (TRUE);
    END AFTERPFORM;
    FUNCTION P_SHIP_END_RANGEVALIDTRIGGER RETURN BOOLEAN IS
    BEGIN
    RETURN (TRUE);
    END P_SHIP_END_RANGEVALIDTRIGGER;
    FUNCTION VALUE_ENTERED(LEX_NAME IN VARCHAR2) RETURN BOOLEAN IS
    BEGIN
    IF LEX_NAME > ' ' AND LEX_NAME <> '1=1' AND LEX_NAME IS NOT NULL THEN
    RETURN (TRUE);
    ELSE
    RETURN (FALSE);
    END IF;
    END VALUE_ENTERED;
    PROCEDURE SET_LEXICAL_PARAMETERS IS
    PLS_ORIG_P1 VARCHAR2(32766);
    BEGIN
    P_L_SHIPMENT_GGID := REPLACE(P_L_SHIPMENT_GGID
    ,'~'
    IF VALUE_ENTERED(P_L_SHIPMENT_GGID) THEN
    P_L_SHIPMENT_GGID := 'WHERE SH.P_L_SHIPMENT_GGID ' || REPORTS_LIBRARY.GET_FILTER_CONDITION(P_L_SHIPMENT_GGID,NULL,'Y');
    ELSE
    P_L_SHIPMENT_GGID := '1=1';
    END IF;
    END SET_LEXICAL_PARAMETERS;
    END PRI_SEC_OCEAN_FCL_BOOKING_VIEW;
    Thanks,
    Dev

    Hi Dev,
    I am not aware that you could change the value of P_L_SHIPMENT_GGID this way.
    One quick way to test that will be to set it to default to something like 'where 1=2' in your concurrent program and see if it runs but produce no results.
    If it indeed does run, then it confirms my thinking.
    You can then do something like this;
    Try creating a global variable in your pri_sec_ocean_fcl_booking_view package header, say G_L_SHIPMENT_GGID.
    Calculate your lexical string and put it in G_L_SHIPMENT_GGID.
    Reference G_L_SHIPMENT_GGID in your query
    FROM SHIPMENT_INVOLVED_PARTY SH,
    CONTACT CT
    &G_L_SHIPMENT_GGID
    .......Kofi

  • Error in Dynamic LOV with Bind Variable

    Hi
    I created 2 Dynamic LOV's in which Second one is with a Bind Variable.Then I creted a Form and Attached the LOV's to the form fields.But I am getting the below mentioned error when i choose a value in the First LOV and the Second LOV is not Populated. I tried the same thing with the scott.dept and scott.emp table which is working fine.but when i try the same on my tables it is throwing me error.
    Can Anyone Suggest me what is the problem of these LOVs
    FYI
    1)I am writing SELECT on Views in the LOVs and the views are created on tables of a different of database.
    2)Below Mentioned LINK_TIT is my DB Link.
    Error Message:
    An unexpected error occurred: ORA-01722: invalid number
    ORA-02063: preceding line from LINK_TIT (WWV-16016)
    Error displaying form : ORA-01722: invalid number
    ORA-02063: preceding line from LINK_TIT (WWV-16408)
    Error displaying block : ORA-01722: invalid number
    ORA-02063: preceding line from LINK_TIT (WWV-16406)
    Error displaying item : ORA-01722: invalid number
    ORA-02063: preceding line from LINK_TIT (WWV-16404)
    Error ORA-01722: invalid number
    ORA-02063: preceding line from LINK_TIT, displaying DUMMY_FRM_BLEND.DEFAULT.SKU5ID.01, combobox (WWV-16405)
    The preference path does not exist: ORACLE.WEBVIEW.PARAMETERS.16172911255 (WWC-51000)

    Hi Everyone,
    This was a known Issue in Oracle 9i AS Portal.I referred to the
    metalink note ID 174116.1 which talks about the BUG No:1584284.and it gives some workaround to come across the BUG.
    I got my dependent LOV work after changing the NUMBER datatype in the Procedure to VARCHAR2.(Then in the PL i converted the character to number by the SQL function.)
    Regds
    Rajesh Kanna.V

  • Problem in Dynamic LOV query

    Hi,
    I have a LOV in my page its query should be based on item condition.
    So I tried using Apex provided Dynamic LOV Query with IF.. ELSE.. END IF condition.. But when I use this and run the page it is giving error "URL NOT FOUND".
    My query is
       IF :MY_ITEM is not null THEN
       RETURN 'select ename ,eno
                    from emp
                    where eno = '''||:MY_ITEM||''' ';
       ELSE
        RETURN 'select ename ,eno
                    from emp
                    where ename = ''ALAKA''  ';
       END IF;But it is not working for me.
    Please anyone help me to solve this.
    Thanks
    Alaka

    Hi All,
    It worked for me. Just I modified my code a bit. Thanks to all for help.
    Just I did ,
       DECLARE
       BEGIN
             IF :MY_ITEM IS NOT NULL THEN
                RETURN 'SELECT ENAME,ENO
                            FROM EMP
                            WHERE ENAME = '''||:MY_ITEM||''' ';
           ELSE
               RETURN 'SELECT ENAME,ENO
                            FROM EMP
                            WHERE ENAME = ''ALAKA'' ';
          END IF;
          EXCEPTION
            WHEN OTHERS THEN
                HTP.PRN('ERROR'||SQLERRM);
       END;
    Thanks
    Alaka

  • Balancing Segment Value set Does't show values and Giving error Page.

    In R12,LOV of Balancing segment, doesn't show values and giving error page while creating Retained Earnings Account in Ledger Options Page.
    If once the ledger options finished, and it gets the status completed, can't we modify the Ledger options in future.
    By mistake we finished. can i delete Primary ledger from Accounting stucture?
    Thanks in advance,
    VRC Murthy

    Turn on the dynamic insert for your chart of account structure.
    Make sure you have at least one value in each of the value value set attached to COA segments. Make sure retained earning account value exists in your Account value set.
    Now you will be able to pick your retained earnings account in Accounting Setups screen.
    After completing your ledger setup you will be able to modify some options like suspense account, reversal set, future enterable periods etc.
    I have explained the GL setup in detail in my online training videos at http://handsonerp.com
    Regards
    Edited by: user2648997 on Nov 13, 2009 11:50 AM

  • Problem with dynamic LOV and function

    Hello all!
    I'm having a problem with a dynamic lov in APEX 3.0.1.00.08. Hope you can help me!
    I have Report and Form application. On the Form page i have a Page Item (Popup Key LOV (Displays description, returns key value)).
    When i submit the sql code in the 'List of vaules defention' box. I get the following message;
    1 error has occurred
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    When i excecute the code below in TOAD or in the SQL Workshop it returns the values i want to see. But somehow APEX doesn't like the sql....
    SELECT REC_OMSCHRIJVING d, REC_DNS_ID r FROM
    TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
    returns_dns_lov_fn is a function, code is below;
    CREATE OR REPLACE FUNCTION DRSSYS.return_dns_lov_fn (p2_dns_id number)
    RETURN dns_table_type
    AS
    v_data dns_table_type := dns_table_type ();
    BEGIN
    IF p2_dns_id = 2
    THEN
    FOR c IN (SELECT dns_id dns, omschrijving oms
    FROM d_status dst
    WHERE dst.dns_id IN (8, 10))
    LOOP
    v_data.EXTEND;
    v_data (v_data.COUNT) := dns_rectype (c.dns, c.oms);
    END LOOP;
    RETURN v_data;
    END IF;
    END;
    and the types;
    CREATE OR REPLACE TYPE DRSSYS.dns_rectype AS OBJECT (rec_dns_id NUMBER, rec_omschrijving VARCHAR2(255));
    CREATE OR REPLACE TYPE DRSSYS.dns_table_type AS TABLE OF dns_rectype;
    I tried some things i found on this forum, but they didn't work as well;
    SELECT REC_OMSCHRIJVING display_value, REC_DNS_ID result_display FROM
    TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
    SELECT REC_OMSCHRIJVING display_value d, REC_DNS_ID result_display r FROM
    TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
    SELECT a.REC_OMSCHRIJVING display_value, a.REC_DNS_ID result_display FROM
    TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) a order by 1
    Edited by: rajan.arkenbout on 8-mei-2009 14:41
    Edited by: rajan.arkenbout on 8-mei-2009 14:51

    I just had the same problem when I used a function in a where clause.
    I have a function that checks if the current user has acces or not (returning varchar 'Y' or 'N').
    In where clause I have this:
    where myFunction(:user, somePK) = 'Y'
    It seems that when APEX checked if my query was valid, my function triggered and exception.
    As Varad pointed out, check for exception that could be triggered by a null 'p2_dns_id'
    Hope that helped you out.
    Max

  • Creating a dynamic lov based on a column

    Hi,
    I want to create a dynamic lov based on a column in a database-table.
    Eg. the query
    'select code, description from code_table'
    is the contents of the column 'lov_query' in the table 'parameters'.
    For every parameter there can be a different lov-query, but the result is always
    two columns (code and description, number and name, etc.), exactly what you need to use in a lov.
    I've written a (dbms_sql) function that takes the parameter-id and returns the lov_query.
    create or replace function "GET_PMR_LOV"
    (pmr_id in NUMBER)
    return VARCHAR2
    is
    cur INTEGER := DBMS_SQL.OPEN_CURSOR;
    fdbk INTEGER;
    l_pmr_id NUMBER(9) := pmr_id;
    l_stmnt VARCHAR2(2000);
    begin
    DBMS_SQL.PARSE
    (cur, 'select pmr.lov_query from parameters pmr where pmr.ID ' || ' = 'L_PMR_ID', DBMS_SQL.NATIVE);
    DBMS_SQL.BIND_VARIABLE (cur, 'L_PMR_ID', l_pmr_id);
    DBMS_SQL.DEFINE_COLUMN (cur, 1, l_stmnt, 2000);
    fdbk := DBMS_SQL.EXECUTE (cur);
    fdbk := DBMS_SQL.FETCH_ROWS (cur);
    IF fdbk > 0
    THEN
    DBMS_SQL.COLUMN_VALUE (cur, 1, l_stmnt);
    return (l_stmnt);
    ELSE     
    return null;
    END IF;
    DBMS_SQL.CLOSE_CURSOR (cur);
    END;
    But now I'm stuck on how to pass on this statement in HTMLDB
    as an dynamic lov, I don't seem to be able to execute this statement
    into the two display and return columns. Any ideas?

    Hello again,
    This lov is on an updatable report-column where the user has to make a choice from an non-named, popup and query-based lov. In the lov-query box I have just put:
    "return get_pmr_lov(:p41_param_id)" (without the quotes ;-)
    Here's my latest version plus an alternative, which both seem to work fine:
    create or replace function "GET_PMR_LOV"
    (pmr_id in NUMBER)
    return VARCHAR2
    is
    cur INTEGER := DBMS_SQL.OPEN_CURSOR;
    fdbk INTEGER;
    l_pmr_id NUMBER(9) := pmr_id;
    l_stmnt VARCHAR2(1000);
    begin
    DBMS_SQL.PARSE (cur, 'select pmr.lov_query from paramaters pmr where pmr.ID ' || '= :L_PMR_ID', DBMS_SQL.NATIVE);
    DBMS_SQL.BIND_VARIABLE (cur, 'L_PMR_ID', l_pmr_id);
    DBMS_SQL.DEFINE_COLUMN (cur, 1, l_stmnt, 1000);
    fdbk := DBMS_SQL.EXECUTE (cur);
    fdbk := DBMS_SQL.FETCH_ROWS (cur);
    IF fdbk > 0 THEN
    DBMS_SQL.COLUMN_VALUE (cur, 1, l_stmnt);
    return (l_stmnt);
    ELSE
    return null;
    END IF;
    DBMS_SQL.CLOSE_CURSOR (cur);
    END;
    create or replace function "GET_PMR_LOV2"
    (pmr_id in NUMBER)
    return VARCHAR2
    is
    l_pmr_id NUMBER(9) := pmr_id;
    l_stmnt VARCHAR2(1000);
    BEGIN
    EXECUTE IMMEDIATE 'select pmr.lov_query from parameters pmr where pmr.ID = :1'
    INTO l_stmnt USING l_pmr_id;
    return l_stmnt;
    END;
    The error-message remains the same, unable to bind :p41_param_id !

  • Dynamic lovs in parameter forms ... Is this possible?

    Hi
    I am using report developer 10g on windows xp.
    I need a cascading prompt style dynamic LOVs in my report parameter form.
    The first LOV displays a set of values (say for eg. dept list). The second LOV will display another list, based on the value chosen by the user in the first LOV (Eg. List of employee names in that dept).
    My first LOV select statement may look like below for the user parameter say P_DEPT
    select deptno from dept;
    My sencod LOV select stmnt may look like below for the user parameter P_EMP
    select ename from emp where deptno = :P_DEPT
    Each time I try to set the second LOV, report developer complains "Bind variables not allowed in select statement"
    Same error msg comes if I reference the first user parameter(P_DEPT) as a lexical parmaeter.
    How do I acheive the above in report parameter form? Any help is appreciated greatly...
    Thanks
    Suma
    Message was edited by: suma
    user519129

    Hi Brad,
    Thanks for the reply. I had almost given up hope on receiving replies to this message.
    I do agree that it is simpler (and a lot striaght forward) to just use forms to develop dynamic LOVs of cascading prompt style, that is required in my app. But in our shop, we have integrated forms and reports in such a way, that all the report parameters are handled by report developer's own parameter form, rather than coding a separate logic on the forms side to handle the report parameters(as this has to be done on the forms side for every report that we generate, We thought it would be better to use the reports developer to handle the parameter input and then pass the .rdf to forms app). Currently in all our app, the parameter form generated by the report developer is rendered as HTML form on the browser (when the concerned rdf file is called within the forms app) and by submitting this we get the report output)
    Hence I am very keen to get this done somehow on the report developer side.
    I do hope I get some input on this. Also, its a little surprising that such a simple feature is not readily avalibale in the report parameter form. I hope oracle report developer team is reading this message...:)
    Thanks
    Suma

  • Item Selection on a dynamic LOV (SQL Query)

    Hi,
    I've a dynamic LOV with an SQL query who return a list of data (one column). When i select a data in this LOV to be use as an item (sql query) in the same page the data is always null. In debug mode substitution string is null.
    FYI : when the data is selected, a button is clik to perform an sql query for a report in another page.
    Thanks. Sorry Abasolute beginner
    Message was edited by:
    user581765

    Thanks for Your help.
    The date is in fact a CHAR display (not really a date) so that is not the error.
    For your information when i select a row in the list (format char YYYYMMDD_HHMM) it seems that Apex do not catch my select in the Session state.
    I've change the item name with P2_DATE_FLOW but the problem remain.
    This is the debug log if can help
    0.03: Application 114, Authentication: CUSTOM2, Page Template: 3644802034190382
    0.06: ...Session ID 1868105032215374 can be used
    0.06: ...Application session: 1868105032215374, user=Neop
    0.06: ...Determine if user "Neop" workspace "2859608277950243" can develop application "114" in workspace "2859608277950243"
    0.06: Session: Fetch session header information
    0.06: ...Metadata: Fetch page attributes for application 114, page 3
    0.06: Fetch session state from database
    0.06: Branch point: BEFORE_HEADER
    0.06: Fetch application meta data
    0.08: Computation point: BEFORE_HEADER
    0.08: Processing point: BEFORE_HEADER
    0.08: Show page template header
    0.08: Computation point: AFTER_HEADER
    0.08: Processing point: AFTER_HEADER
    0.08: Computation point: BEFORE_BOX_BODY
    0.08: Processing point: BEFORE_BOX_BODY
    0.08: Region: Report 1
    Report 1
    0.08: show report
    0.09: determine column headings
    0.09: parse query as: CFM_MDRE
    0.12: binding: ":P2_DATE_FLOW"="P2_DATE_FLOW" value="0"
    0.14: print column headings
    0.14: rows loop: 15 row(s)
    No data found.

  • Problem in getting dynamic LOV

    hi i am trying to acheive dynamic LOV.
    i followed the steps
    1.created a static record group
    2.created a LOV and assigned with the above created static record group.
    3.in w-n-b-i trying to create the DRG
    DECLARE
       rg_id    RECORDGROUP;
       grp_col  GROUPCOLUMN;
       rg_name  VARCHAR2(25) := 'RG_NAME';
       col_name VARCHAR2(25) := 'TYPE';
       lov_id   LOV;
    BEGIN
       /* Check if the RG already exists */
       rg_id := Find_Group(rg_name);
       IF ( NOT Id_Null(rg_id) ) THEN
          Delete_Group(rg_id);
       END IF;
       /* Create instance of DRG */
       rg_id := Create_Group(rg_name);
       grp_col := Add_Group_Column(rg_id, col_name, CHAR_COLUMN, 8);
       /* Assign the DRG to the LOV */
    lov_id := Find_Lov('TYPE_LOV');
       Set_Lov_Property(lov_id, GROUP_NAME, rg_name);
    END;4.in w-v-i of type
    DECLARE
       rg_id   RECORDGROUP;
       grp_col   GROUPCOLUMN;
       tmp_gc  GROUPCOLUMN;
       rg_name   VARCHAR2(25) := 'RG_TYPE';
       col_name   VARCHAR2(25) := rg_name||'.'||'TYPE';
       n_dummy1  NUMBER;
       n_dummy2  NUMBER;
       curr_rec   INTEGER;
       err_code  NUMBER;
    BEGIN
       curr_rec := Get_Block_Property(Name_In('SYSTEM.TRIGGER_BLOCK'), CURRENT_RECORD);
       rg_id := Find_Group(rg_name);
       grp_col := Find_Column(col_name);
       /* Add the value to the DRG */
       -- Add row first./*
       Add_Group_Row(rg_id, END_OF_GROUP);
       -- Now add the value.
       Set_Group_Number_Cell(grp_col, curr_rec, To_Number(:BMM_DESC));
       /* Verify the value was added */
       n_dummy1 := Get_Group_Row_Count(rg_name);
       tmp_gc := Find_Column(col_name);
       FOR j IN 1..n_dummy1 LOOP
          n_dummy2 := Get_Group_Number_Cell(tmp_gc, j);
          IF ( nvl(n_dummy2, 9999999999) = 9999999999 ) THEN
             Clear_Message;
             Message('Add Failed');
             Message('Add Failed');
          ELSE
             err_code := Populate_Group(rg_id);
             Clear_Message;
             Message('Add Successful');
          END IF;
       END LOOP;
          MESSAGE('FIRING');MESSAGE('FIRING');
    END;the problem is the lov is not appearing at all(previously the lov was appearing along with the static value assigned)
    when i tried to add value to the item(type), i am getting the following error:
    FRM-40735 WHEN-VALIDATE-ITEM trigger raised unhandled exception ora-06502
    i am getting pop up message-error in adding group row
    i have not done this before. in the help of some contents which is present in the fourm, i have tried it.
    where i am missing?
    Please help

    there seems to be problem with the item type, varchar2 or numeric whatever. check that.

  • Problem - Creating a Dynamic LOV using duplicate value in select statement

    I am trying to create a Dynamic LOV by attempting to follow a pattern similar to the following:
    select shop_name d, shop_id r
    from shops
    order by 1
    However, I want to use the shop_name twice as in the following because I do not have any other unique identifier available such as a shop_id to associate with the shop name:
    select shop_name d, shop_name r
    from shops
    order by 1
    But I get an error where I am not allowed to duplicate the shop_name in the select statement. I read somewhere on this forum where it can be done but I can't find exactly how.
    Can someone tell or show me how to accomplish this?
    Thanks in anticipation for your answer.
    Thanks,
    Ric

    Ric,
    I just tried to do this on APEX 3.0, and it worked just fine with this SQL:
    select ename d, ename r from emp order by 1Perhaps you could put an example on apex.oracle.com or specify the error message that you're getting.
    So as long as you have uniquely aliased both columns, this should not present a problem.
    Thanks,
    - Scott -

  • Dynamic LOV in universe based report

    Hi,
    My question is simple.
    In Crystal Reports ,is it possible to have a dynamic LOV for the prompts when the report is based on universe? When ever the user chooses the drop down in prompt page, he should see only his values in LOV. This works in WebI.
    I read from the forum that in crystal, this can only be possible with Business View. Is this true?
    If i use Business view and the user opens the report in Infoview, does he needs DSN to use the connection i have created in Business View to refresh the LOV dynamically?
    Please suggest a solution for dynamic LOV as this started as a simple issue and i'm breaking my head to solve this!!

    Once you create any dynamic parameter in crystal which is using direct database connection and if you publish that report to server then it automatically generates a list of values using business view in repository in which the business view uses the same connection what you have used for the report. Now when you try to run the report in info view first it prompts for LOV from repository. Before refreshing the LOV it prompts to connect to your database and if you don't want this prompt to popup everytime then open the connection in business view manager and in the properties select never prompt by giving the database credentials.
    You can also create LOV using universe as datasource. To get the updated list you need to change the registry key settings like this
    select the option Always refresh before use in the universe properties and change the registry like this
    HKEY_LOCAL_MACHINE\software\business objects\suite 11.5\crystal reports\database\AlwaysRefreshUniverseLOV
    Type: String
    Recognized Values: Yes, 1
    HTH
    Raghavendra.G

  • Return statment for dynamic LOV - exception handling

    Hello All,
    Good Morning.
    Oracle 11g, apex 3.2.1
    I am having an dynamic LOV with a return statement.
    code :-
    ==========================
    declare
    owner varchar2(12) :='';
    stmt varchar2(4000) :='';
    No_Records_Exception exception ;
    phase varchar2(30);
    year varchar2(30);
    month_quarter varchar2(30);
    begin
    stmt :='select distinct famid d, famid r from '
    ||:P1_SCHEMA||'.'||'FMLY';
    return stmt;
    exception
    when No_Records_Exception then
    raise_application_error (-20998 , ' Schema does not exist ' );
    when OTHERS then
    raise_application_error (-20999,' Select the schema first ' );
    end;
    ===================
    My question is - why the exception is not handled when there are no table found.
    Am getting the following errr ..
    Error: ORA-06550: line 1, column 120: PL/SQL: ORA-00903: invalid table name ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored performing List of Values query: "select distinct famid d, famid r from .FMLY".
    Pls let me know how to handle this error.. if the table is invalid.
    scenario for poping this error:-
    ==================
    I am having three "select list with redirect" items and one radio group ( having two Radion buttons - Relation , Famid )
    The requirement is when the user selects Famid radio then the lov is suppose to populate the multiselect list with famid values from table P2D2008M05.FMLY and the schema P2D2008M05 is selected from three list items
    P2D, 2008 , M05 one from each item .
    If the schema is not selected and the user selects radio famid , then the error is coming , I need to put a validation or error handling mechanism when in which ,if the user selects famid radio and the schema is not selected , I need to raise an exception with proper error message to the user saying that the schema is not selected.
    Pls helpin this regard.
    Thanks/kumar.

    Hi,
    Your exception is for function that return select.
    Error is raised when Apex procedures try use select your function returns.
    You need test your select inside function or create validations
    Your function could look something like this
    DECLARE
      stmt    VARCHAR2(4000);
      l_count NUMBER;
    BEGIN
      IF NVL(:P1_SCHEMA,'%'||'null%') = '%'||'null%' THEN
        raise_application_error (-20999,' Select the schema first ' );
      END IF;
      SELECT COUNT(1) INTO l_count FROM all_users WHERE username = :P1_SCHEMA ;
      IF l_count = 0 THEN
        raise_application_error (-20998 , ' Schema does not exist ' );
      END IF;
      stmt :='select distinct famid d, famid r from ' ||:P1_SCHEMA ||'.' ||'FMLY';
      RETURN stmt;
    END;That is just example, I did not test it. And I think it is not good idea raise errors inside LOV function.
    You should use Apex after submit validations
    Br,Jari

  • Dynamic LOV on form in update mode

    I have a link to a portal form that specifies the primary key as below:
    Portal30.wwv_user_utilities.get_url(
    'application.form_link',
    'primary_id',to_char(id),
    '_primary_id_cond','=');
    This works well. I can access the form in update mode for the specified row. However, on the form I have 2 combo boxes: one is for make of vehicle and the other for model. The make combo box uses an lov derived from a simple table query. The model combo box is a dynamic lov using a query based upon the value of the model. When entering the form in update mode, it fails to set the make bind variable to anything, so the model is left blank with no options. How can I set the value of the make bind variable on the link so I can get the dynamic lov for the model to be populated correctly?
    (I have already tried to add the model to the url link, to no avail).
    null

    Hi noor,
    When I click the link button I am opening the userdefined form and filling the corresponding document number details manually.
    Do you mean, you're filling the form, field by field???
    If so you're doing it wrong. That way the form has no connection to the correct Database record and cannot update it.
    The correct way is as follows:
    Put a DocEntry field in your form and bind it to the DocEntry database field.
    Set this field to NOT Visible by default.
    When a user clicks the LinkButton, you change the form mode to FindMode, make the DocEntry field visible use the oForm.Items.Item("DocEntry").Specific.Value = "" method to set the correct value to the field (use the DocEntry number NOT the DocNum) and use the oForm.Items.Item("1").Click() to open the correct record.
    Then the user can change the value it needs without errors.
    Best Regards,
    Vítor Vieira

Maybe you are looking for