How to get a single quote in a string

this is my code, how do i get a * ' * around the :p2_marketingcode so that the result will be
and marketingcode_id LIKE 'SP09663'
i tryed something like this ||'''||:p2_marketingcode||''';
if :p2_marketingcode is not null then
q:=q||' and marketingcode_id LIKE '||:p2_marketingcode;
end if;

Try:
if :p2_marketingcode is not null then
q:=q||' and marketingcode_id LIKE '''||:p2_marketingcode||'''';
end if;

Similar Messages

  • How to escape a single quotes from a string of dynamic sql clause?

    if a single quotes exist in a dynamic sql clause for a string,
    like
    v_string :='select tname from tab where tabtype='table'',
    there tabtype='table' will conflict with the single quote ahead.
    could somebody tell me how to escape this single quotes?
    thanks for your tips,
    frederick

    fredrick,
    To represent one single quotation mark within a literal, enter two single quotation marks. For example :
    v_string :='select tname from tab where tabtype=''table'''
    Regards,
    Srinivas

  • How do I pass single quotes into a string variable?

    Thanks for any help?
    Example
    Select xdat, yday
    from foo
    where
    xdat = to_char(sysdate, 'mm/dd/yyyy')
    How do I pass the single quoted stuff above into a string variable?

    Thank you but that is not the same thing. I am building a dynamic sql statement and need to pass the quoted material into a statement that is quoted Is that not what my example above shows?
    My example above has a quoted string inside a string. I think this is exactly what you were asking for.

  • How to pass a single quote in a URL using Javascript

    Can someone tell me how to pass a single quote in a URL using Javascript. I have created a Javascript funciton in which I pass several column values from an APEX report.
    The URL for the report link I am using is "JAVASCRIPT:passBack('#EMP_ID#','#Name#','#e-mail#')"
    The problem occurs with the Name and e-mail columns contain a single quote (i.e. James O'Brien)

    Thank you Saad, that worked.
    Since I built the report using type 'SQL Query (PL/SQL function fody returning SQL query)' I had to add some additional quotes to get it to work.
    i.e.
    replace(EMP_EMAIL_NAME,'''''''',''\'''''')
    or
    replace(EMP_EMAIL_NAME,chr(39),''\'''''')
    Thanks for the help,
    Jason

  • How to get a single pulse Using Burst MOde?

    Harlow Peeps! Just want to know how to get a SINGLE pulse generated by the AGILENT 33220A function generator? the results i get it's in the burst MODE and everything is running smoothly and fine! it's just that i want to get a single pulse froM it only and not repeated triggeriong of the pulse...
    thanks! ^^
    cheers!

    hi,
    find attached an example, how to set hp33250a ( ag33xxx )  into burst mode.
    hope this helps........... - play with it - and change it to your needs.
    regards
    Werner
    Attachments:
    hp33250a _burst.zip ‏165 KB

  • DATA TRANSFER - How to get a SINGLE SPACE in downloaded txt file from UNIX?

    Hi Experts,
    Am sending data from SAP to UNIX/ Application server and text file on desk top as well.
    So, I am keeping a single character just SPACE at the END of each record.
    Then, When I see the downloaded text file, I found a SINGLE SPACE at the end of each record, fine.
    Then, by using CG3Y t code, I downloaded the UNIX file to my desk top.
    But, When I see this UNIX downloaded file from UNIX, I did NOT find any SPACE at the end of each record!!!
    Am doing every thing same in both cases.
    So,
    1 - Why its happening in case of UNIX file?
    2 - How to get a SINGLE SPACE  at the END in the downloaded file from UNIX?
    thanq

    Its there, I am talking abut this -
    OPEN DATASET - linefeed
    Syntax
    ... WITH { NATIVE
             | SMART
             | UNIX
             | WINDOWS } LINEFEED ... .
    Alternatives:
    1. ... WITH NATIVE LINEFEED
    2. ... WITH SMART LINEFEED
    3. ... WITH UNIX LINEFEED
    4. ... WITH WINDOWS LINEFEED
    Effect
    : These additions determine which line end marker is used for text files or legacy text files. If these additions are used, the profile parameter abap/NTfmode is ignored. Simultaneous specification of the values "UNIX" or "NT" in the addition TYPE is not permitted.
    If these additions are not used, the line end marker is determined as follows, depending on the operating system of the current application server:
    The line end marker for Unix is "LF". Under Unix, OS390 and OS400, only "LF" is used for reading and writing.
    The line end marker for MS Windows is "CRLF". Under MS Windows, however, the values of the profile parameter abap/NTfmode can also be used to set whether new files are handled according to Unix conventions or Windows conventions. If the profile parameter has the value "b", the Unix line end marker "LF" is used. If the profile parameter has the value "t" or is initial, the Windows line end marker "CRLF" is used. The setting using the profile parameter can be overridden with the addition TYPE and the value "UNIX" or "NT". If an existing file is opened without the addition TYPE, this is searched for the first line end marker ("LF" or "CRLF"), and this is used for the whole file. If no line end marker is found, the profile parameter is used. This applies particularly if an existing file is completely overwritten with FOR OUTPUT.
    If an addition WITH NATIVE|SMART|UNIX|WINDOWS LINEFEED is used, this setting can be changed for the open file using the statement SET DATASET. If neither of the additions is used, the line end marker also cannot be changed using SET DATASET.
    Notes
    : Without the use of an addition WITH LINEFEED, the line end marker is dependent on diverse implicit factors such as the operating system of the application server, a profile parameter, and line end markings that are already used. For this reason, the explicit use of WITH LINEFEED is recommended, which renders the use of the addition TYPE for setting the line end marker obsolete.
    The line end marker that is currently used can be determined for every open file using GET DATASET.
    Alternative 1
    ... WITH NATIVE LINEFEED
    Effect
    : This addition defines the line end marker independently of the access type according to the operating system of the application server, i.e. "LF" for Unix OS390 or OS400, and "CRLF" for MS Windows.
    The line end marker is interpreted according to the current codepage. If a code page is explicitly specified using the addition CODE PAGE, the characters of the line end marker must exist be available or be written in accordance with this code page.
    Note
    : The addition WITH NATIVE LINEFEED is intended for editing files on an application server that can also be accessed by other means. The addition receives the appropriate line end marker without the program needing to know the operating system.
    Alternative 2
    ... WITH SMART LINEFEED
    Effect
    : This addition depends on the access type:
    In files that are opened for reading using FOR INPUT, both "LF" and "CRLF are interpreted as a line end marker. When opening an EBCDIC file with the addition CODEPAGE, in addition to "LF", "CRLF", and the EBCDIC character strings, the corresponding ASCII character strings are also recognized. In addition, the EBCDIC character "NL" (line separator) is also interpreted as a line end marker.
    In files opened for appending or changing with FOR APPENDING or FOR UPDATE, the program searches for a line end marker that is already used in the file. In this process, first the end of the file is identified. If no line end marker is found there, a certain number of characters at the beginning is analyzed. If a line end marker is found, this is used when writing to the file. This is also affected by the addition CODE PAGE. For example, ASCII line end markers are recognized and used in a file opened with EBCDIC, but not the other way round. If no line end marker is found or no search is possible (for example, if the file is opened with the addition FILTER), the line end marker is determined according to the operating system of the application server, as with the addition WITH NATIVE LINEFEED.
    In files opened for writing using FOR OUTPUT, the line end marker is determined according the operating system of the application server, as with the addition WITH NATIVE LINEFEED.
    Note
    : The addition WITH SMART LINEFEED is intended for the generic editing of files in heterogeneous environments. The line end marker is recognized and set for different formats. The use of this addition is the best solution for most application cases.
    Alternative 3
    ... WITH UNIX LINEFEED
    Effect
    : The line end marker is set to "LF" regardless of the access type and operating system of the application server.
    The line end marker is interpreted according to the current code page. If a code page is specified explicitly using the addition CODE PAGE, the characters of the line end marker must be available or be written according to this code page.
    Note
    : The addition WITH UNIX LINEFEED is intended for editing Unix files in which the specific line end markers are to be retained, even if the operating system of the current application server is MS Windows.
    Alternative 4
    ... WITH WINDOWS LINEFEED
    Effect
    : The line end marker is set to "CRLF" regardless of the access type and operating system of the application server.
    The line end marker is interpreted according to the current code page. If a code page is specified explicitly using the addition CODE PAGE, the characters of the line end marker must be available and be written according to this code page.
    Note
    : The addition WITH WINDOWS LINEFEED is intended for use with MS Windows files in which the specific line end marker is to be retained, even if the operating system of the current application server is Unix, OS390 or OS400.

  • DATA TRANSFER - How to get a SINGLE SPACE in the downloaded file from UNIX?

    Hi Experts,
    Am sending data from SAP to UNIX/ Application server and text file on desk top as well.
    So, I am keeping a single character just SPACE at the END of each record.
    Then, When I see the downloaded text file, I found a SINGLE SPACE at the end of each record, fine.
    Then, by using CG3Y t code, I downloaded the UNIX file to my desk top.
    But, When I see this UNIX downloaded file from UNIX, I did NOT find any SPACE at the end of each record!!!
    Am doing every thing same in both cases.
    So,
    1 - Why its happening in case of UNIX file?
    2 - How to get a SINGLE SPACE  at the END in the downloaded file from UNIX?
    thanq

    Hi,
    I don't know if this works:
    perform SET_TRAIL_BLANKS(saplgrap) using 'X'.  
    perform SET_FIXLEN(saplgrap) using '0' '060'.   "put length of your line from-to
    ... download ...
    It will put space at the end of your line, according to the length.
    Hope it works,
    Chang

  • How to get rid of quotes in SQL?

    Hi All!
    Does anybody know how to get rid of quotes in
    generated SQL? I don't mean manual editing.
    Are there any properties controlling this
    behavior (adding "" automatically)?
    Thanks in advance!
    Sincerely,
    Lev

    Use PreparedSatement class,
    e.g.
    // Where the name field is defined as char, i.e. needs quotes in SQL.
    String sql = "select * from person where name = ? ";
    PreparedStatement statement = connection.prepareSatement(sql);
    statement.setString(1, "Bob");
    statement.executeQuery();
    This will get rid of hardcoding db vendor dependant quotes in your sql,
    Hope this helped.

  • How to Delimit the Single quotes ( ' )

    Hi friends.
    how to delimite the single quotes ( ' )  or
    how to move the single quotes in fields.
    any body pls reply
    thanks
    pauldharma

    Hi,
    Use for single quotes and that will result in a single quote.
    i.e.
    lv_quote = ''''.
    Darren

  • Finding location of single quote ( ' ) in a string

    Hi,
    I have a need to find the location of second single quote in a string.
    Below query works fine for a string without single quote. It gives me the location of word 'HIER' for 2nd occurrence.
    select instr('HIER A HIER B','HIER',2) from dual
    I want to do the same with single quote. I am trying with the below query.
    select instr('HIER A '' HIER B ''',chr(39),2) from dual
    But it always gives me the location of first occurrence of single quote and not the second.
    Any idea about this issue..?
    Thanks

    select regexp_replace('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ','.*''(.*)''.*','\1') from dual
    select substr('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ',instr('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ','''')+1,instr('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ','''',1,2)-instr('AND ( ACCT_V.HIER_NODE_NM = ''D0100'' AND TODAYS_DATE IS NULL ','''')-1) from dualComment to the second approach: check SUBSTR() syntax, the second numeric parameter is length of the fragment, not the ending position. Still, RE approach is way shorter and more readable, isn't it? ;)

  • Single quote in the String????

    Hello All,
    I want to supress the meaning of single quote in the string, so that I can use the string as one of the fields in my sql query, for doing this inserting "/" before the single code is the way or is there any other standard way to achieve this.
    Thanks in Advance,
    Sarada.

    usually you need to use the scape character for stopping the meaning of a single qoute, or even double quite \', \"
    String s = "select empname from emps where id=\'123\'" ;
    Regards

  • How to replace double quotes with a single quote in a string ?

    Hi All:
    Can some one tell me how to replace double Quote (") in a string with a single quote (') ? I tried to use REPLACE function, but I couldn;t get it worked.
    My example is SELECT REPLACE('STN. "A"', '"', ''') FROM Dual --This one throws an error
    Thanks,
    Dima.

    Whether it is maybe not the more comfortable way, I like the quoting capabitlity from 10g :
    SQL> SELECT REPLACE('STN. "A"', '"', q'(')') FROM Dual;
    REPLACE(
    STN. 'A'{code}
    Nicoals.                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to escape a single quote in a find mode view

    Hello,
    I'm working with JDeveloper 10g.
    I've defined a view that is used in "find mode" in a JSP.
    When a value with a single quote is inserted in a field of the search form, an exception is thrown:
    JBO-27122: SQL error during statement preparation.
    ORA-00907: missing right parenthesis.
    The problem is that the "single quote" is not being escaped:
    WHERE STREET LIKE 'ABAT ESCARRE, DE L'A'
    How could I force the view to escape the "single quote"?
    Thanks

    Arrest the single quote by calling a javascript method.
    This might help you
    Re: af:clientListener javascript function call question
    http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e12419/tagdoc/af_clientListener.html
    Edited by: Srinidhi on Mar 23, 2011 3:46 PM

  • How to get a single row column from a viewobject in java?

    I have a class file that goes out and gets a viewobject and sets its where clause
    this is it:
    vcRow = vc.createViewCriteriaRow();
    vcRow.setAttribute("LogonId", "='" + strPcis_Login.toUpperCase() + "'");
    vc.addElement(vcRow);
    vo.applyViewCriteria(vc);
    vo.executeQuery();
    I know this working cause I can watch it in debug..
    but now the problem.
    I've looked in the docs and don't see how one can pull the value of the row it found and place it in a uix page in a textinput area
    how can I get a single row column, in this case the UserName that is in the view object to a string and then place it into my
    uix page? I've looked and looked and don't see a method for this.
    is there a way to take the oracle.cabo.servlet.Page and set a textinput with a viewobject get method?
    what way do you do this and where is it documented?

    is there a way to take the oracle.cabo.servlet.Page and set a textinput with a viewobject get method?
    what way do you do this and where is it documented? What you can do is get the value from your VO and set it somewhere that UIX can data bind to -- as a Page proprety, on HttpSession, etc. This is documented in Chapters 4 (Data Binding) and 5 (Controller) of the UIX Developer's Guide.
    To set a property, you use Page.setProperty(String key, String value). Then, in your UIX file, to make a textInput that has the value pulled from a given page property, use:
    <textInput data:text="key@ctrl:page" />
    -brian
    Team UIX

  • How to get to single user mode

    I aquired an old power mac G4 with an old account with 10.3.9 and an old administrator account.  It seems that procedures to remove the account start in Single user mode.  The computer won't start when holding down system - s.  The drive clicks a few times but the display goes to sleep from no video signal.  So How can I get to single user mode when the usual way don't work?

    The hard drive's directory may be dead, or it may have last been booted into Mac OS 9.  IF you are lucky, they did install Mac OS X on it, and that can be determined either through an Option key boot, or through an X key boot on a wired (not wireless) USB Apple compatible keyboard.   X key booting will only work if the X operating system is on the same partition, whereas Option key boot will reveal the Startup Manager, where you select the drive and hit the right pointing arrow for the drive partition that has Mac OS X.   Note this will not work on an original PCI PowerMac G4.   You may also need to replace the PRAM battery, a 1/2 AA 3.6V battery from Radio Shack before any boot sequence will work.  Once it boots into Mac OS X, Single User Mode should work.

Maybe you are looking for