Putting Single Quote in any field
Hi All,
What is the purpose of putting ' ' (Single Quote) in any of the field?
Example:
Object:F_BKPF_BUK
Field:
ACTVT:01
BUKRS:' ' -
> What does this imply?
Hi,
what do you mean by 'single quote'? If you mean 'blank', this has the same meaning as an empty value in the field. So if the application checks for any value, but not for an empty field, the check will fail.
Regarding the docu: you can access it through some different ways, for instance in SE38->display source code of any report->press the blue 'I' infobutton->enter ABAP key-word authority-check, select authority-check->abap statement, enjoy the documentation.
b.rgds, Bernhard
Edited by: Bernhard Hochreiter on Sep 15, 2008 3:31 PM
Similar Messages
-
How to concatenate single quote with any field like 'VBAK'
Hi,
How to concatenate single quote with any fields.
say for example I have table name as MARA, I have to pass that table name to other fields with single quote , like I have to pass that as
tab name = 'MARA'.
but how to do this,
below statement will not work
concatenate ''' 'MARA' ''' into string.. it's giving syntax error...
Regards,
Mrunalgv_name = 'MARA'.
gc_quote = '''.
CONCATENATE gc_quote gv_name gc_quote INTO value.
Pushpraj -
SQL: Need help putting single quote around string
I want to put single quotes around string in my output.
I am running the following command as a test:
select ' ' hello ' ' from dual;
My expectation is to get 'hello' (Single quote around hello)
However I am getting the following error:
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
When I do SHOW ALL at my SQL command prompt, the escape is set as follows:
escape "\" (hex 5c)
I even tried: select '\'hello\'' from dual;
I get back: select ''hello'' from dual
ERROR at line 1:
ORA-00923: FROM keyword not found where expectedHi,
user521525 wrote:
I want to put single quotes around string in my output.
I am running the following command as a test:
select ' ' hello ' ' from dual;
My expectation is to get 'hello' (Single quote around hello)You probably read that you can get a single-quote within a string literal by using two of them in a row.
That's true, but they really have to be in a row (no spaces in between), and you still need the single-quotes at the beiginning and end of the literal.
So what you want is
SELECT '''hello'''
FROM dual;Starting in Oracle 10, you can also use Q-notation, For example:
SELECT Q'['hello']'
FROM dual; -
How can i concatenate single quote to a field symbol
hi
i have a senario where i have to concatenate a single quote (') to the field symbol. it is simple but i' m not able to do that.
concatenate ''' <f> ''' into lv_f.
CONCATENATE lv_condition_temp lv_f INTO
lv_condition_temp
SEPARATED BY space.
this is the code which i used. could someone help me in solving this...
thanks & regards,
subha....hi
i tried using the following code
data : lv_text(10) type c.
concatenate ''' <f> ''' into lv_text.
it is giving me a spelling or incorrect comma error.
thanks & regards,
subhashini. -
How to deal with single quote (') in a field value?
I can successfully insert value with single quoet using
Prepared statement with placeholder(?) construct .
I can also successfuly use value with single quote(') in
WHERE clause.
My question is, is there a way to use string with single
quote if a Statement like:
String slqString ="INSERT INTO customers (name, address) VALUES ( 'O'Reilly Bob', 'St Mary's Street') ";
Statement sqlStmt = con.createStatement();
sqlStmt.executeUpdate(sqlString);
The last statement will thow an SQLException because due to single quotes
Any ideas?I think the question was regarding the ' in O'Reily. Use ' twice when using the Statement interface, i.e.
("O''Reilly Bob", "St Mary''s Street")
So that's two single quotes, not a double quote, to successfully insert a single quote, if you know what I mean....
But like you said PreparedStatement does things like this for you. -
How to put single quotes around selected data
Is there a way to return selected column value with single quotes around it?
Example I have a table:
select name from test_table;
returns: George Clooney
I want it to return 'George Clooney'
I tried: select '''||name||''' from test_table;
returns: '||name||'...or
SCOTT@demo102> select chr(39)||ename||chr(39) from emp;
CHR(39)||ENA
'SMITH'
'ALLEN'
'WARD'
'JONES'
'MARTIN'
'BLAKE'
'CLARK'
'SCOTT'
'KING'
'TURNER'
'ADAMS'Nicolas. -
How to put single quotes inside single quotes
Hi all,
My requriement is to put a statement
LIKP~VSTEL <> INF
in a variable LV.
For that I have written
CONCATENATE LV 'LIKP~VSTEL <> "INF" ' INTO LV.
where LIKP is a table as VSTEL is a table field.
When this LV is used inside a select query, the value for LIKP~VSTEL is "INF", but I want without the double quotes. Can any one please help me with this.
Thanks and Regards,
AvinashHi,
Iif you mean LV should hold something like LIKP~VSTEL = ' INF ', then try this
data: c_quote(4) type c value ''''.
data: l_inv type string.
CONCATENATE c_quote 'INF' c_quote into l_inv.
CONCATENATE ' LIKP~VSTEL' '=' l_inv INTO LV separated by space.
Regards,
Vikranth.
Edited by: Vikranth.Reddy on Sep 1, 2009 1:55 PM -
Put single quote around input data
Hi all,
DB:10G
Have an input field (P10_item) with text value . Sometimes it can be multiple text values separated by , like T-123,T-870 . sometimes it only has 1 text value.
How do I construct a query that can take the item and convert the input value to the following example ? By using length function I can find out how many check no in the field but am lost in how to put the ' around each check no. Help
ex:
select * from payment where checkno in ('T-123','T-870')
thankswith t as
(select 'T-123,T-870' txt from dual )
select replace(regexp_replace(txt,'(.+)','''\1'''),',',''',''')from t;
'T-123','T-870'sorry I did not understand what you wanted at first.
this shoud break p_10_item into multiple entries if it has commas in it and
then you can join it to the payment table.
WITH t AS (SELECT 'T-123,T-870' p_10_item FROM DUAL),
t2
AS ( SELECT REGEXP_SUBSTR (p_10_item,
'[^\,]+',
1,
LEVEL)
checkno
FROM t
CONNECT BY LEVEL <=
LENGTH (p_10_item)
- LENGTH (REPLACE (p_10_item, ','))
+ 1)
SELECT payment.*
FROM payment, t2
WHERE t2.checkno = payment.checknoEdited by: pollywog on May 18, 2011 1:14 PM -
Getting rid of single quotes and other bad characters
Hello All-
I am writing a servlet that takes a value from a form, and saves it to a database. However, when single quotes, and other illegal characters are entered, i get all sorts of errors. I am certain their is some function that would take care of all of this.
Help!Hi there,
When you try to insert single quotes into the database it gives an error or problem because a single quote is a reserved character in the database.
If you want to store a single quote or any other character that is reserved in the database then you need to find out how to escape that reserved character.
One option is to use the single quote twice, so instead of ' , use '' (not double quote but , type single quote twice).
Another option is to use HTML entity code for single quote
"Message was edited by:
appy77 -
Any way to generate a single quote (') with XSLT?
Hi:
I guess this is really an XSLT question. I'm using the Transform() method of an XMLType variable to apply a style sheet. The XML in the variable is just something simple like
<TBL>
<LAST_NAME>LIKE|JONES</LAST_NAME>
<FIRST_NAME>=|MARY</FIRST_NAME>
<AGE>=|50</AGE>
</TBL>
I am trying to get a stylesheet to transform something like the above into SQL such as
Select * from foo where LAST_NAME like 'JONES'
and FIRST_NAME ='MARY'
and AGE = 50But to do this, I need to generate the single quotes around the search terms and I can't get anything but LAST_NAME LIKE 'JONES'. Is there a way to do this? For now I am generating a ~ and replacing ~ for ' throughout the generated SQL text but that's a pretty sorry solution.
I thought that something like <xsl:text disable-output-escaping="yes">&</xsl:text> was going to work but then found out it has been deprecated. I was thinking character-map might work but that's an XSLT 2.0 thing and apparently 10g is on XSLT 1.0? In any case, it had no idea what I was trying to do with a character map.
So, am I overlooking an obvious way to get my stylesheet to insert apostrophes?
Thanks.It's 10.2.0.4.
Here's the procedure that accepts the XML/XSL clobs and tries to produce a SQL statement.
PROCEDURE GetSQLQueryFromXML(XMLClob in CLOB, XSLStylesheet in CLOB,
SQLQuery out CLOB, status out integer) IS
-- Define the local variables
xmldata XMLType; -- The XMLType format of the XML to transform
xsldata XMLType; -- The XMLType format of the stylesheet to apply
sqlQuery_XMLType XMLType; -- The XMLType format of the SQL query.
v_SQLQuery Clob; -- Holds XML Clob before translating ~ to '
BEGIN
status := -1; -- Initially unsuccessful
-- Get the XML document using the getXML() function defined in the database.
-- Since XMLType.transform() method takes XML data as XMLType instance,
-- use the XMLType.createXML method to convert the XML content received
-- as CLOB into an XMLType instance.
xmldata := XMLType.createXML(XMLClob);
-- Get the XSL Stylesheet using the getXSL() function defined in the database.
-- Since XMLType.transform() method takes an XSL stylesheet as XMLType instance,
-- use the XMLType.createXML method to convert the XSL content received as CLOB
-- into an XMLType instance.
xsldata := XMLType.createXML(XSLStylesheet);
-- Use the XMLtype.transform() function to get the transformed XML instance.
-- This function applies the stylesheet to the XML document and returns a transformed
-- XML instance.
sqlQuery_XMLType := xmldata.transform(xsldata);
-- Return the transformed XML instance as a CLOB value.
v_SQLQuery := sqlQuery_XMLType.getClobVal();
-- Change tildas to apostrophes. Currently unable to get an XSLT transformation
-- to insert single quotes, so we're inserting ~ instead. Now we need to
-- translate all ~s to 's in our query.
SQLQuery := translate(to_char(v_SQLQuery),'~','''');
status := 1; -- Everything went fine to get here
EXCEPTION
WHEN OTHERS THEN
raise_application_error
(-20102, 'Exception occurred in GetSQLQueryFromXML :'||SQLERRM);
END GetSQLQueryFromXML;The XML it works off of is
someXML CLOB :=
to_clob('<?xml version="1.0" encoding="windows-1252" ?>
<variable table_name="SOME_PERSON_TABLE" query_type="PERSON">
<item>
<fieldName><![CDATA[PERSON_KEY]]></fieldName>
<criteria><![CDATA[=]]></criteria>
<fieldType><![CDATA[Integer]]></fieldType>
<value><![CDATA[123456789]]></value>
</item>
<item>
<fieldName><![CDATA[LAST_NAME]]></fieldName>
<criteria><![CDATA[=]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value><![CDATA[DOE]]></value>
</item>
<item>
<fieldName><![CDATA[FIRST_NAME]]></fieldName>
<criteria><![CDATA[=]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value><![CDATA[JOHN]]></value>
</item>
<item>
<fieldName><![CDATA[MIDDLE_NAME]]></fieldName>
<criteria><![CDATA[-]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value />
</item>
<item>
<fieldName><![CDATA[SUFFIX]]></fieldName>
<criteria><![CDATA[-]]></criteria>
<fieldType><![CDATA[String]]></fieldType>
<value />
</item>
</variable>');And the corresponding XSLT that should translate it is:
myStylesheet CLOB :=
to_clob('<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- <xsl:preserve-space elements="list-of-element-names"/> -->
<!-- We just want the SQL text output. No XML declaration etc. -->
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
<!-- Apostrophes will be made tildas and the PL/SQL will translate those to -->
<!-- apostrophes for the final SQL string. -->
<xsl:variable name="apos">~</xsl:variable>
<xsl:template match="/">
select * from
<xsl:value-of select="variable/@table_name"/>
where 1=1
<xsl:for-each select="variable/child::node()">
<xsl:choose>
<!-- if the value node is not null... -->
<xsl:when test="./value/text()[normalize-space(.)]">
<!-- There is another predicate. Add the AND term and the predicate -->
AND <xsl:value-of select="./fieldName"/>
<xsl:text> </xsl:text>
<xsl:value-of select="./criteria"/>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="string(./fieldType)=''String''">
<xsl:copy-of select="$apos" />
<xsl:value-of select="./value"/>
<xsl:copy-of select="$apos" />
</xsl:when>
<xsl:when test="string(./fieldType)=''Clob''">
<xsl:copy-of select="$apos" />
<xsl:value-of select="./value"/>
<xsl:copy-of select="$apos" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>');Basically if the VALUE element has a value then the fieldType is checked. If fieldType is String or Clob then we'll need the apostrophes. For now I'm putting in tildas and changing them later. -
Adding SIngle quotes around a Colmn Name stored in a DB Field
I know the SQL I need to execute ( It yeilds 500 rows )
select p.DS_ID
from dbo.v_ds p
inner join dbo.Rpt r
on p.DS_ID = r.PKVal
and r.ColumnNm = 'DS_ID'
BUT the value of r.Column in stored in a table and building it using dynamic SQL , the closest i get is
select p.DS_ID
from dbo.v_ds p
inner join dbo.Rpt r
on p.DS_ID = r.PKVal
and r.ColumnNm = DS_ID
Note that ther single quotes needed are missing and so I get NO rows. I've tried using the ''' + @field + ''' and cannor get it to work.
Any ideas?Not sure of your try. May be you would have missed the single quote before and after as you said your closest ry result looks like below:
and r.ColumnNm = DS_ID --Without single quotes. -
To insert single quote in a varchar2 field
hi guys,
i am facing a simple problem, can any one of you help me in this regard. the problem is i am unable to insert a single quote in a varchar2 field like
SQL> DESC EMP
Name Null? Type
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
SQL> INSERT INTO EMP (EMPNO, ENAME) VALUES (100, 'Mc'Aure') ;
ERROR:
ORA-01756: quoted string not properly terminated
oracle takes ' as the delimiters for identifying the word. in my case the name itself contains a single quote which is to be inserted. how to insert the single quote
i want to insert it from asp coding and also from sql plus 8.0.
advanced thanks
ananthIf you use a ' in a varchar2, it must be marked with a second '.
In your case:
SQL> INSERT INTO EMP (EMPNO, ENAME) VALUES
(100, 'Mc''Aure') ;
null -
How to construct a sql query when field having single quote
Hi all,
I have been working on web application , here is my requirement:
I'm constructing sql statement dynamically from dynamic user input (form data). In one of the field having single quote.
while executing the query it is getting problem because of single quote .. so how do i resolve my problem.
single quote should be there. (I'm using Ms-Access as my database).
Thanks in advance
abelUse PreparedStatement. Always. It not only eases setting Java objects in a SQL query, but also protects you against SQL injections.
Prepare yourself: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html]. -
Is there any way to change literals from double to single quotes?
I'm converting a small application in C# / .net that runs on several other databases to HANA.
The escaped double quote thing is pretty painful - is there any way to change the default literals from double to single quote on the connection or though the driver or otherwise?
Thanks -- ChadHi Chad
can you please provide an example of what runs with other DBMS but doesn't with SAP HANA?
- Lars -
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
Maybe you are looking for
-
Hi, and help! I've got iTunes 11.1.1 on my MacBook Air, and for some reason the search function is being wonky. If I type, say, "dave mason" or "burning spear" or "manu chao" in the search box and hit enter, I get a blank page - well, not completely
-
Why is my Wi-Fi greyed out? Why does battery not hold a charge longer than a few hours? All since upgrade to IOS 7.
-
Hello, please, I have million of records and I need to replace LAST THREE characters, regardless of what they are, in column that is always of the same length e.g.,1234abc need to be: 1234000 i.e., to keep first four characters! thanks
-
Skills Profile and Profile Matchup - Manager Notification
In the Skills Profile and Profile Matchup (service EMPLOYEE_SKILLSENHPROFILE_SERVICE_13) when an employee updates one of their skills there is a message written to the screen that "Your manager will then be notified of the changes.". I do not see an
-
Is KM required for 'publish to EP6' - portal content & role?
is KM required in EP for 'publish to EP6' - portal content & role? we are not try to publish to KM catalog, etc. just the portal content and role. does KM required for that? Thanks Jane