Lexical parameter and single quotes

I am using perl to build the lexical parameter that is being passed to the report builder. The perl builds an "in" statement for the where clause. In the data the users select some of the values may contain a single quote. I have used a perl script to replace the internal single quote with two single quotes.
Example:
selected values: eeee'ss, ffff'22ww
final string passed: "in ('eeee''ss', 'ffff''22ww')"
I am getting any error message indicating quoted string not properly terminated. Any ideas?
Thanks

I have actually found that if the single quote is embedded in the string I can get it to work, however, if the single quote is at the end of the string I am still getting the error message.
To get it to work with the single quote in the string I actually had to create the string with 3 single quotes in place of the embedded one single quote.
Thanks for the suggestion. I will check it out.

Similar Messages

  • Problem with lookup-table and single quotes

    SOA Suite 10.1.3.3. I have an ESB project with an XSLT map that uses orcl:lookup-table to translate values. I use this instead of lookup-dvm because I want non-IT users to manage the mappings without having access to the ESB Console.
    According to the doco:-
    G.1.79 lookup-table
    orcl:lookup-table(table, inputColumn, key, outputColumn, datasource)
    This function returns a string based on the SQL query generated from the parameters.
    The string is obtained by executing:
    SELECT outputColumn FROM table WHERE inputColumn = key
    The problem I'm having is that it seems if "key" contains a single quote (i.e an apostrophe), then lookup-table fails to find the corresponding value - even though the value in table.inputColumn also contains the single quote.
    I've put the incoming into an XSL variable, but to no avail.
    <xsl:variable name="incoming">
    <xsl:value-of select="/obj1:DEV_MESSAGE_TYP/DATA1"/>
    </xsl:variable>
    <xsl:variable name="dvm-text">
    <xsl:value-of select="orcl:lookup-table('MYTABLE','INVAL',$incoming,'OUTVAL','ds/dev')"/>
    </xsl:variable>
    Are there any XSLT Gurus out there that have come across this or can think of ways around it?
    Thanks in advance...
    Regards,
    Greg

    Ok - the above was on the right track but wasn't 100% because it can't handle more than 1 single quote (apostrophe) in the input to lookup-table.
    I've since found a better solution - an XSLT re-usable template that operates recursively and so can replace multiple occurances of single quotes. I've modified it to handle a null input value, otherwise lookup-table will just return the value of the first row in the lookup table - doh! The way I've done it below, if null is passed in, then null will be returned.
    This goes at the top of your XSLT map file...
    <!-- reusable replace-string function -->
    <xsl:template name="replace-string">
    <xsl:param name="text"/>
    <xsl:param name="from"/>
    <xsl:param name="to"/>
    <xsl:choose>
    <xsl:when test="contains($text, $from)">
         <xsl:variable name="before" select="substring-before($text, $from)"/>
         <xsl:variable name="after" select="substring-after($text, $from)"/>
         <xsl:value-of select="$before"/>
         <xsl:value-of select="$to"/>
    <xsl:call-template name="replace-string">
    <xsl:with-param name="text" select="$after"/>
    <xsl:with-param name="from" select="$from"/>
    <xsl:with-param name="to" select="$to"/>
         </xsl:call-template>
    </xsl:when>
    <xsl:when test="$text=''">NULL</xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$text"/>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    Then you call it from within the XSLT map as follows:-
    <!-- if contains a single quote, replace with 2x single quotes. This makes lookup-table work! -->
    <xsl:variable name="incoming">
    <xsl:call-template name="replace-string">
    <xsl:with-param name="text" select="inp1:myinputfield"/>
    <xsl:with-param name="from">'</xsl:with-param>
    <xsl:with-param name="to" select="'&amp;apos;&amp;apos;'"/>
    </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="dvm-text">
    <xsl:value-of select="orcl:lookup-table('MYLOOKUPTABLE','INVAL',$incoming,'OUTVAL','ds/dev')"/>
    </xsl:variable>
    <!-- lookup-table returns null if input value not found. Output original value instead -->
    <xsl:choose>
    <xsl:when test="$dvm-text=''">
    <xsl:value-of select="inp1:myinputfield"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$dvm-text"/>
    </xsl:otherwise>
    </xsl:choose>
    Much Thanks to everyone who shares information and methods on the Internet!
    Cheers,
    Greg

  • Report parameter field value has a single quote. need to escape before pass

    Report has a parameter whose value might have a single quote in it. If I pass that value directly into the SQL Command... like
    where ... user_name = {?parm_user_name}...
    which would translate to
    user_name='O'Donnel Honda'
    I am getting an error... so would like to convert this parameter value into 'O''Donnel Honda' before passing into the query.
    I created a formula called parse_user_name with following:
    Replace ({?parm_user_name}, "'", "''")
    And used in the query like
    where ... user_name = {@parse_user_name}...
    I am getting an error like invalid SQL92 character...

    I think you should use the condition like this
    where ... user_name = '{?parm_user_name}'
    keep the parameter in single quote at the command level itself.
    Now use the same formula like
    replace({?Parameter},"'","''")
    This works only if the parameter is a single value parameter but not multi value parameter.
    Regards,
    Raghavendra

  • SQL*Loader and data enclosed by single quotes

    Hello,
    I need to migrate some data from Sybase to Oracle. Can't use the Migration Workbench because this is Sybase's SQL Anywhere product. We are therefore trying to load via SQL*Loader.
    Sybase outputs its data into text files and encloses it with single quotes, like:
    'ABC123',
    'UR94LL',
    '7YUHII'
    We are running into a problem because we cannot figure out how to use the OPTIONALLY ENCLOSED BY parameter with single quotes. If we just use the FIELDS TERMINATED BY parameter, then the entire string, including the quotation marks, gets loaded into the Oracle table. This causes bad records to be created when the data is exactly the length of the column width - the two quotation markss make the field longer than is allowed in the table. Plus - the data shouldn't have quotes around it in normal situations.
    We can do 'Find and Replace' to replace the single quotation marks with double quotations, but some of the Sybase tables are huge, and we'd like to avoid having to open and edit them. However, if this is the only way to go, then we'll have to use it. I just wondered whether anyone had run into this before and been able to solve it.
    Thanks.
    -melissa

    We are running into a problem because we cannot figure out how to use the OPTIONALLY ENCLOSED BY parameter with single quotesTry
    OPTIONALLY ENCLOSED BY X'27'http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1015083

  • Passing Condition as lexical parameter

    Hi All,
    I am developing one XML report by using XML Dtata templet.
    I have the require ment like to check the cdition on bassis of the USER Parameter value if the parameter is null then place the min and max value of the column.
    In my data templet I declare the lexical parameter
    And in my PL/SQL package I declare the function where I am building the string.
    When I am submitting the cuncorrent program it is throughing me the error.
    Data templet
    <?xml version="1.0" encoding="UTF-8" ?>
    <dataTemplate name="XXGLR005_1" defaultPackage="XXX_GL_GLSPF_XMLP_PKG" version="1.0">
    <properties>
    <property name="include_parameters" value="true"/>
    <property name ="debug_mode" value="on" />
    </properties>
    <parameters>
              <parameter name="p_ledger" dataType="varchar2"/>
              <parameter name="p_balancing" dataType="varchar2"/>
              <parameter name="p_start_period" dataType="varchar2"/>     
              <parameter name="p_end_period" dataType="varchar2"/>
              <parameter name="p_start_fc" dataType="varchar2"/>
              <parameter name="p_end_fc" dataType="varchar2"/>
              <parameter name="p_start_site" dataType="varchar2"/>          
              <parameter name="p_end_site" dataType="varchar2"/>
              <parameter name="p_where" dataType="varchar2"/>
         </parameters>
    <lexicals>
    </lexicals>
    <dataQuery>
    <sqlStatement name="Q_1">
    <![CDATA[
    SELECT account,
    account_description,
    SUM (amount_period_range) amount_period_range,
    SUM (fisical_ytd_amount) fisical_ytd_amount,
    SUM (cumilative_found) cumilative_found,
    account_type,actual_flag,period_name
    FROM (SELECT gcc.segment4 ACCOUNT, ffv.description account_description,
    (CASE ba.currency_code
    WHEN 'CAD'
    THEN (ba.period_net_dr - ba.period_net_cr)
    ELSE (ba.period_net_dr_beq - ba.period_net_cr_beq)
    END
    ) AS amount_period_range,
    (CASE ba.currency_code
    WHEN 'CAD'
    THEN ( (ba.begin_balance_dr - ba.begin_balance_cr)
    + (ba.period_net_dr - ba.period_net_cr)
    ELSE ( (ba.begin_balance_dr_beq
    - ba.begin_balance_cr_beq
    + (ba.period_net_dr_beq - ba.period_net_cr_beq)
    END
    ) AS fisical_ytd_amount,
    (CASE ba.currency_code
    WHEN 'CAD'
    THEN ( (ba.begin_balance_dr - ba.begin_balance_cr)
    + (ba.project_to_date_dr - ba.project_to_date_cr
    ELSE ( (ba.begin_balance_dr_beq
    - ba.begin_balance_cr_beq
    + ( ba.project_to_date_dr_beq
    - ba.project_to_date_cr_beq
    END
    ) AS cumilative_found,
    gcc.account_type account_type, ba.period_name,
    ba.actual_flag
    FROM gl_code_combinations gcc,
    gl_balances ba,
    gl_periods gp,
    fnd_flex_value_sets fvs,
    fnd_flex_values_vl ffv
    WHERE gcc.code_combination_id = ba.code_combination_id
    AND ba.period_name = gp.period_name
    AND ffv.flex_value_set_id = fvs.flex_value_set_id
    AND ffv.flex_value = gcc.segment4
    AND fvs.flex_value_set_name = 'AHS_ACCOUNT'
    AND ba.actual_flag <> 'B'
    AND gcc.segment1 = '101'
    &p_where
    AND gcc.segment2 BETWEEN '0006' AND '0006'
    AND gcc.segment4 = '31030000'
    AND gp.start_date >= TO_DATE ('01/08/2010', 'DD-MM-YYYY')
    AND gp.end_date <= TO_DATE ('30/11/2010', 'DD-MM-YYYY')
    AND gcc.account_type IN ('E', 'R'))
    GROUP BY period_name, actual_flag, ACCOUNT, account_description, account_type
    ]]>
    </sqlStatement>
    <sqlStatement name="Q_2">
    <![CDATA[
    SELECT NAME LEDGER_NAME
    FROM gl_ledgers
    WHERE ledger_id =:p_ledger
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="beforeReportTrigger" source="XXX_GL_GLSPF_XMLP_PKG.XXX_GL_SPF_SUMMARY_REP" />
    <dataStructure>
         <group name="G_1" source="Q_1">
                   <element name="account" value="account"/>
                   <element name="account_description" value="account_description"/>
                   <element name="amount_period_range" value="amount_period_range"/>
                   <element name="fisical_ytd_amount" value="fisical_ytd_amount"/>
                   <element name="cumilative_found" value="cumilative_found"/>
                   <element name="account_type" value="account_type"/>
         </group>
         <group name="G_2" source="Q_2">
              <element name="LEDGER_NAME" dataType="varchar2" value="LEDGER_NAME"/>
         </group>
         </dataStructure>
    </dataTemplate>
    Package Specification
    CREATE OR REPLACE PACKAGE APPS.XXX_GL_GLSPF_XMLP_PKG AUTHID CURRENT_USER AS
    -- Package Name : XXX_GL_GLSPFDETAIL_XMLP_PKG
    -- Author's Name : Nihar Ranjan Panda
    -- RICE Object id : GL-REP-05
    -- Purpose : Package Specification
    -- Program Style :
    -- Maintenance History
    -- Date Version# Name Remarks
    -- 28-Nov-2010 1.0 Nihar Ranjan Panda Initial Devp
    --Global Parameters
    p_ledger varchar2(100);
    p_balancing varchar2(10);
    p_start_period varchar2(10);
    p_end_period varchar2(10);
    p_start_fc varchar2(20);
    p_end_fc varchar2(20);
    p_start_site varchar2(10);
    p_end_site varchar2(10);
    p_start_mail_id varchar2(30);
    p_end_mail_id varchar2(30);
    p_purge_history varchar2(10);
    p_where varchar2(1000);
    P_CONC_REQUEST_ID number;
    type spf_ref_cursor is REF CURSOR;
    type rec_spf is record
    account varchar2(20),
    account_description varchar2(100),
    amount varchar2(20),
    account_type varchar2(1),
    currency varchar2(3),
    gl_date varchar2(11),
    je_category varchar2(50),
    code_combination_id varchar2(100),
    line_description gl_je_lines.description%Type,
    batch_name gl_je_batches.NAME%Type,
    je_line_num gl_je_lines.je_line_num%TYPE,
    --transaction_date varchar2(11),
    je_header_num gl_je_headers.je_header_id%Type
    function XXX_GL_SPF_SUMMARY_REP return boolean;
    END XXX_GL_GLSPF_XMLP_PKG;
    Package body
    CREATE OR REPLACE PACKAGE BODY APPS.XXX_GL_GLSPF_XMLP_PKG
    AS
    -- Package Name : XXX_GL_GLSPFDETAIL_XMLP_PKG
    -- Author's Name : Nihar Ranjan Panda
    -- RICE Object id : GL-REP-05
    -- Purpose : Package Body
    -- Program Style :
    -- Maintenance History
    -- Date Version# Name Remarks
    -- 28-Nov-2010 1.0 Nihar Ranjan Panda Initial Devp
    FUNCTION XXX_GL_SPF_SUMMARY_REP
    RETURN BOOLEAN
    IS
    l_min_fc VARCHAR2 (20) := '';
    l_max_fc VARCHAR2 (20) := '';
    l_min_site VARCHAR2 (20) := '';
    l_max_site VARCHAR2 (20) := '';
    l_start_date VARCHAR2 (11) := '';
    l_end_date VARCHAR2 (11) := '';
    BEGIN
    IF p_start_fc IS NULL
    THEN
    SELECT MIN (flex_value)
    INTO l_min_fc
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id =
    (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_FUNCTIONAL_CENTRE');
    p_start_fc := l_min_fc;
    END IF;
    IF p_end_fc IS NULL
    THEN
    SELECT MAX (flex_value)
    INTO l_max_fc
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id =
    (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_FUNCTIONAL_CENTRE');
    p_end_fc := l_max_fc ;
    END IF;
    IF p_start_site IS NULL
    THEN
    SELECT MIN (flex_value)
    INTO l_min_site
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id = (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_SITE');
    p_start_site :=l_min_site;
    END IF;
    IF p_end_site IS NULL
    THEN
    SELECT MAX (flex_value)
    INTO l_max_site
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id = (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_SITE');
    p_end_site := l_max_site;
    END IF;
    SELECT TO_CHAR (start_date, 'DD-MM-YYYY')
    INTO l_start_date
    FROM gl_periods
    WHERE period_name = p_start_period;
    SELECT TO_CHAR (end_date, 'DD-MM-YYYY')
    INTO l_end_date
    FROM gl_periods
    WHERE period_name = p_end_period;*/
    p_where := ('AND gcc.segment3 BETWEEN '''|| p_start_fc ||''' AND '''||p_end_fc||''
    AND gcc.segment2 BETWEEN '''|| p_start_site ||''' AND '''||p_end_site||'''
    AND gp.start_date >= '''||TO_DATE (l_start_date,'DD-MM-YYYY')||'''
    AND gp.end_date <= '''||TO_DATE (l_end_date,'DD-MM-YYYY')||''''*/
    RETURN (TRUE);
    EXCEPTION
    WHEN OTHERS
    THEN
    raise_application_error (-20101,NULL);
    NULL;
    END XXX_GL_SPF_SUMMARY_REP;
    END XXX_GL_GLSPF_XMLP_PKG;
    Error file
    Custom Extensions: Version : UNKNOWN
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    XXGLR005 module: AHS GL SPF Summary Report
    Current system time is 07-DEC-2010 23:39:22
    XDO Data Engine Version No: 5.6.3
    Resp: 20434
    Org ID : 82
    Request ID: 3275555
    All Parameters: p_ledger=2021:p_balancing=101:p_start_period=AUG-10:p_end_period=NOV-10:p_start_fc=71110600018:p_end_fc=71110600018:p_start_site=0006:p_end_site=0006
    Data Template Code: XXGLR005
    Data Template Application Short Name: XXX
    Debug Flag: N
    {p_end_period=NOV-10, p_end_fc=71110600018, p_end_site=0006, p_start_fc=71110600018, p_balancing=101, p_start_period=AUG-10, p_ledger=2021, p_start_site=0006}
    Calling XDO Data Engine...
    [120710_113928978][][STATEMENT] Start process Data
    [120710_113928979][][STATEMENT] Process Data ...
    [120710_113928981][][STATEMENT] Executing data triggers...
    [120710_113928981][][STATEMENT] BEGIN
    XXX_GL_GLSPF_XMLP_PKG.p_ledger := :p_ledger ;
    XXX_GL_GLSPF_XMLP_PKG.p_balancing := :p_balancing ;
    XXX_GL_GLSPF_XMLP_PKG.p_start_period := :p_start_period ;
    XXX_GL_GLSPF_XMLP_PKG.p_end_period := :p_end_period ;
    XXX_GL_GLSPF_XMLP_PKG.p_start_fc := :p_start_fc ;
    XXX_GL_GLSPF_XMLP_PKG.p_end_fc := :p_end_fc ;
    XXX_GL_GLSPF_XMLP_PKG.p_start_site := :p_start_site ;
    XXX_GL_GLSPF_XMLP_PKG.p_end_site := :p_end_site ;
    XXX_GL_GLSPF_XMLP_PKG.p_where := :p_where ;
    :XDO_OUT_PARAMETER := 1;
    END;
    [120710_113928985][][STATEMENT] 1:2021 :
    [120710_113928985][][STATEMENT] 2:101 :
    [120710_113928985][][STATEMENT] 3:AUG-10 :
    [120710_113928985][][STATEMENT] 4:NOV-10 :
    [120710_113928985][][STATEMENT] 5:71110600018 :
    [120710_113928985][][STATEMENT] 6:71110600018 :
    [120710_113928985][][STATEMENT] 7:0006 :
    [120710_113928985][][STATEMENT] 8:0006 :
    [120710_113928985][][STATEMENT] 9:null :
    [120710_113929388][][STATEMENT] Executing data triggers...
    [120710_113929388][][STATEMENT] Declare
    l_flag Boolean;
    BEGIN
    l_flag := XXX_GL_GLSPF_XMLP_PKG.XXX_GL_SPF_SUMMARY_REP ;
    if (l_flag) then
    :XDO_OUT_PARAMETER := 1;
    end if;
    end;
    [120710_113929420][][STATEMENT] p_ledger
    [120710_113929420][][STATEMENT] p_balancing
    [120710_113929420][][STATEMENT] p_start_period
    [120710_113929420][][STATEMENT] p_end_period
    [120710_113929420][][STATEMENT] p_start_fc
    [120710_113929420][][STATEMENT] p_end_fc
    [120710_113929421][][STATEMENT] p_start_site
    [120710_113929421][][STATEMENT] p_end_site
    [120710_113929421][][STATEMENT] p_where
    [120710_113929421][][STATEMENT] Writing Data ...
    [120710_113929426][][STATEMENT] &p_where
    java.lang.NullPointerException
         at oracle.apps.xdo.dataengine.DataTemplateParser.getObjectVlaue(DataTemplateParser.java:1754)
         at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1473)
         at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:456)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:445)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:308)
         at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:273)
         at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:215)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:254)
         at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(DataProcessor.java:390)
         at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:355)
         at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:334)
         at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:294)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:157)
    Start of log messages from FND_FILE
    End of log messages from FND_FILE
    Executing request completion options...
    Finished executing request completion options.
    Concurrent request completed
    Current system time is 07-DEC-2010 23:39:29
    Could any body please help me fixing this issue...

    Nihaapps,
    It seems like you are missing a default value for p_where. If data templates have the same requirements as RDFs, then lexicals must have a default value that will be valid when the query is verified. The query would have to be checked for validity, and to do that, it has to fill in a value where &p_where is.
    Kurz

  • Incorrect SELECT statement with single quotes

    I am getting the following error trying to select a value from a database:
    SQLException caught: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'mod='Payroll''. Couldn't load driver:[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'mod='Payroll''.
    Here is the select statement code:
    PreparedStatement ps = con.prepareStatement("SELECT username FROM experts WHERE mod='"+mod+"'");
    I have tried all kinds of variations with the quotes, and single quotes but still get the same error...I know I'm on the right track but I can't seem to spot the error and was hoping someone else could??
    thanks in advance,
    chuk

    Hi,
    I tried that and now I get an even stranger syntax error which says "Syntax error (missing operator) in query expression 'mod=Pa_RaM000'."
    any ideas?

  • Passing single quotes in a lexical parameter from forms11g to reports 11g

    Hi,
    We've upgraded our forms and reports from 10.1.2.3 to 11.1.2.1 and this has broken a number of reports where we pass a string of single quoted variables to reports as a lexical parameter.
    v_string := ''''||:block.item1||''''||','||''''||:block.item2||''''
    select *
    from emp
    where emp_id in (&p_string)
    where v_string is simply passed as a text parameter to the report.
    I'm not clear why this should break now (its worked since 6i) and whether anyone is aware of it and/or a solution.
    Any help much appreciated as always
    Thank you

    Hi,
    Thanks for the suggestion I will try and give it a go.
    Do you mean for example in the form:
    v_string := $$dq||:block.item1||$$dq||','||$$dq||:block.item2||$$dq
    And in the report
    Begin
    replace(p_where_string,'$q','''');
    end;
    I would say that this even if this works it will prove painful to be updating every form AND report where this is used as we have a lot! I do really appreciate anyone taking the time to reply though!
    It would appear that there are several bugs recorded against this type of problem when moving to reports 11...
    Bug 11840698 - SIMPLE QUOTE REMOVED WHEN USING RUN_REPORT_OBJECT WITH PARAMLIST
    Status 11 - Code/Hardware Bug (Response/Resolution
    I will continue to update with responses from my SR.
    Thanks

  • Identify and replace a single quote in an In Parameter

    Can anyone tell me the syntax for finding and replacing a single quote in a user entered string? Thanks.

    Cav,
    I tried this:
    insert into emp values (9999,''''||'Must', 'ddd',7902, sysdate, 2000, null, 10) ;
    select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-12-1980        800                    20
          7499 ALLEN      SALESMAN        7698 20-02-1981       1600        300         30
          7521 WARD       SALESMAN        7698 22-02-1981       1250        500         30
          7566 JONES      MANAGER         7839 02-04-1981       2975                    20
          7654 MARTIN     SALESMAN        7698 28-09-1981       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-05-1981       2850                    30
          7782 CLARK      MANAGER         7839 09-06-1981       2450                    10
          7788 SCOTT      ANALYST         7566 19-04-1987       3000                    20
          7839 KING       PRESIDENT            17-11-1981       5000                    10
          7844 TURNER     SALESMAN        7698 08-09-1981       1500          0         30
          7876 ADAMS      CLERK           7788 23-05-1987       1100                    20
          7900 JAMES      CLERK           7698 03-12-1981        950                    30
          7902 FORD       ANALYST         7566 03-12-1981       3000                    20
          7934 MILLER     CLERK           7782 23-01-1982       1300                    10
          9999 'Must      ddd             7902 29-08-2005       2000                    10
    select * from emp where ename = ''''||'Must';
         EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO
          9999 'Must      ddd             7902 29-08-2005       2000                    10Hope this helps
    Ghulam

  • Problem when using WEB.SHOW_DOCUMENT and passing in lexical parameter

    Hi,
    I got a blank page with error "An error has occured while trying to use this document" when I tried to use web.show_document and passing a lexical parameter to 10g report on 10gAS. The URL in the web.show_document is:
    http://<srvname>:<portnum>/reports/rwservlet?server=repserver90&report=myrpt.rdf&destype=Cache&desformat=pdf&userid=<usr>/<pw>@<db>&where_clause=where%20product_type%20in%20('REPORT')
    If I change the desformat to htmlcss, it is fine to display the report. But doesn't work with desformat=pdf. The pdf file has been generated in the cache. Why can't it display on the screen.
    Also I tried to use double quote the value for where_clause. The pdf report showed up. But it ignored the where clause.
    Experts please help.
    Ying

    I use lexical parameters and they work fine, but I use a parameter list. The code is contained in a form that is called by all forms that wish to run a report. This way you only need the logic for printing in a single form. If you want the form, email me at [email protected]

  • Can a single quote be used at the beginning of a query string parameter

    Hi all,
    I am a relative newbie and have a newbie question.
    Can a single quote be used at the beginning of a query string parameter passed to a jsp page? Are there any inherant problems with this? Is there a comprehensive list of characters that must be escaped in a query string parameter?
    Example: http://mysite.com/myjsp.jsp?param1='nghdh
    Thanks

    You'll have to escape most non-letter characters before you can pass them as a URL. I don't know if it's necessary for a single quote, but better safe than sorry.
    Either use java.net.URLEncoder(...) or use javax.servlet.http.HttpServletResponse.encodeURL(String). I wouldn't recommend using unescaped characters in your URLs, that might cause pretty funny behavior that's sometimes hard to trace back. Don't worry about decoding it, your JSP/Servlet container will do it when you call javax.servlet.http.HttpServletRequest.getParameter(String).

  • RWRUN60: Problem with parameter value containing space between single quote

    Hi All
    I'm using RWRUN60 to generate my report by following way:
    C:\orant\BIN\RWRUN60.EXE userid=DBUser/dbpasswor@db BACKGROUND="NO" BATCH="YES" DESFORMAT="pdf" DESNAME="C:\report.pdf" DESTYPE="FILE" ORIENTATION="LANDSCAPE" PARAMFORM="NO" P_REPORTID="2431" P_REPORTNAME="Report Name" report="C:\report.rdf" P_WHERE="StartDate>=to_date('2011-07-14 10-37-00','YYYY-MM-DD HH24-MI-SS')"
    When I tried to run given command above nothing was executed executed and any log didnt created.
    I found out that problem occurs when text between two single quotes contains spaces. In my case it is a parameter P_WHERE. I need to keep such format because it is part of report query.
    When I removed last parameter from command RWRUN60 successfully genereate pdf document.
    Further I added new test parameter P_TEST(it is ignored by rdf) in the end of command line following:
    P_TEST="test '11'" - rwrun60 generates report
    P_TEST="test '1 1'" - rwrun60 doesn't; generate report
    Can somebody help how to resolve given problem. Is it parsing bug or what else?

    Spaces on command lines a very often a bad idea. Get rid of them by changing the command, e.g.:
    to_date('2011-07-14:10-37-00','YYYY-MM-DD:HH24-MI-SS')

  • Data model: single quote in default parameter value

    Hello,
    when I assign a default value to a parameter in my Data model, which includes a single quote (i.e. "It's a default value"), then the single quote is escaped with a backslash (i.e. "It\'s a default value") when I open the report associated with the data model. How can I get rid of the escape character when opening a report?
    Regards,
    Jure

    Hi Yogini,
    Thanks for your reply.
    When the customer name is selected, discoverer reports automatically enclose the customer names in single quotes. like 'ABC LTD', 'ABC's INC',
    I know how to change this single quote format. Also we don't want user to change the parameter selection criteria once selected.
    Also related to double quotes isn't it doubles are treated as column names in the SQL query and can not be used for any other purpose.
    Apologies, I haven't tried this but I think it will not work. Have you tried this with discoverer viewer.
    As mentioned intrusting things is when a customer name with single quote is selected in discoverer Plus it automatically formats the filter criteria to look like ['ABC LTD', 'ABC''s INC'] but this thing doesn't happen in viewer.
    I think this is a bug in discoverer viewer and think there must be some patch available to correct this problem.
    Sorry, don't have a solution yet but will certainly update the thread once I get the solution.
    Also please keep looking for a solution and let me know as well.
    Thanks a lot in advance.
    Best Regards,
    Manish

  • Single Quote in Parameter values...!

    Hi there,
    I am using oracle oracle disco. 10g
    In my report there are 2 parameters. First being the customer name and another being the transaction reference. Transaction reference parameter is based on the customer name(s) selected.
    The customer data contains a single quote [e.g. ABC's]. Thus, when the user selects the customer name [with a single quote] and tries to select the transaction reference - discoverer viewer returns an error message - 'Invalid Value'
    This does not happens in discoverer plus.
    Imp: We can not change the data - otherwise I would have remove the single quote from the customer name as part of my query.
    any ideas..!
    Any help would be really appreciated.
    Best Regards,
    Manish

    Hi Yogini,
    Thanks for your reply.
    When the customer name is selected, discoverer reports automatically enclose the customer names in single quotes. like 'ABC LTD', 'ABC's INC',
    I know how to change this single quote format. Also we don't want user to change the parameter selection criteria once selected.
    Also related to double quotes isn't it doubles are treated as column names in the SQL query and can not be used for any other purpose.
    Apologies, I haven't tried this but I think it will not work. Have you tried this with discoverer viewer.
    As mentioned intrusting things is when a customer name with single quote is selected in discoverer Plus it automatically formats the filter criteria to look like ['ABC LTD', 'ABC''s INC'] but this thing doesn't happen in viewer.
    I think this is a bug in discoverer viewer and think there must be some patch available to correct this problem.
    Sorry, don't have a solution yet but will certainly update the thread once I get the solution.
    Also please keep looking for a solution and let me know as well.
    Thanks a lot in advance.
    Best Regards,
    Manish

  • Run Report with Pass Number and Varchar Lexical Parameter values

    Dear Sir/Madam
    Due to an urgent change required to a report I would most appreciate it if you can please advise me if it is possible to get this report working by either passing in multiple lexical parameters or one signle lexical parameter when calling the SRW.RUN_REPORT command with the following methods:
    Firstly: When calling report with a run_no and spr_cd passed in through one lexical:
    cmd_line: REPORT=D:\DEV\REMITTANCE.rdf BACKGROUND=YES BATCH=NO DESFORMAT=PDF DESTYPE=FILE DESNAME=D:\DEV\REMITTANCE.pdf
    CP_L_PARAM=RUN_NO=TO_NUMBER(28) AND SPR_CD=SUPP1
    Both with a TO_NUMBER and without, whereby I attempt to do a SUBSTR within the query of the called report to derive the RUN_NO Oracle Reports fails to accept the SUBSTR.
    Secondly: I am now trying to call the with passing two lexical parameters into the report as follows:
    cmd_line: REPORT=D:\DEV\REMITTANCE.rdf BACKGROUND=YES BATCH=NO DESFORMAT=PDF DESTYPE=FILE DESNAME=D:\DEV\REMITTANCE.pdf
    CP_L_RUN_NO=||TO_CHAR(lv_run_no)|| CP_L_SPR_CD=||lv_spr_cd;          
    NOTE: The above is an output of the actual command line and not what is passed into the command line, thus the quotes are missing. Please also note that the report is running fine with the only a hard coded RUN_NO value PASSED without the SPR_CD.
    Unfortunately this is also causing issues as the RUN_NO is a number and as you know you can only pass in strings.
    Your urgent help is required on this matter please as our client is expecting a solution this afternoon.
    Hope to hear form you soon.
    Kind regards
    Andrew Mason

    Dont Worry I've worked it out...

  • Dynamic SQL and Data with Single Quotes in it.

    Hi There,
    I have a problem in that I am using dynamic SQL and it happens that one of the columns does contain single quotes (') in it as part of the data. This causes the resultant dynamic SQL to get confused as the single quote that is part of the data is taken to mean end of sting, when in fact its part of the data. This leaves out a dangling single quote that was meant to enclose the string. Here is my dynamic SQL and the result of the parsed SQL that I have captured:
    ****Dynamic SQL*****
    l_sql:='select NOTE_TEMPLATE_ID '||
    'FROM TMP_NOTE_TEMPLATE_VALUES '||
    'where TRIM(LEGACY_NOTE_CODE)='''||trim(fp_note_code)||''' '||
    'and TRIM(DISPLAY_VALUE)='''||trim(fp_note_text)||''' ';
    execute immediate l_sql INTO l_note_template_id;
    Because the column DISPLAY_VALUE contains data with single quotes, the resultant SQL is:
    ******PARSED SQL************
    select NOTE_TEMPLATE_ID
    FROM TMP_NOTE_TEMPLATE_VALUES
    where TRIM(LEGACY_NOTE_CODE)='INQ' and TRIM(DISPLAY_VALUE)='Cont'd'
    And the problem lies with the single quote between teh characters t and d in the data field for DISPLAY_ITEM. How can I handle this?
    Many thanks,

    I have been reliably informed that if one doesn't enclose char/varchar2 data items in quotes, the right indices may not be usedI am into oracle for past 4 years and for the first time i am hearing this.
    Your reliable source is just wrong. Bind variables are variables that store your value and which are used in SQL. They are the proper way to use values in your SQL. By default all variables in PL/SQL is bind variable.
    When you can do some thing in just straight SQL just do it. Dynamic SQL does not make any sense to me here.
    Thanks,
    Karthick.

Maybe you are looking for