Home » SQL & PL/SQL » SQL & PL/SQL » Q-quote mechanism (10g)
Q-quote mechanism [message #352650] Wed, 08 October 2008 15:45 Go to next message
ehegagoka
Messages: 493
Registered: July 2005
Senior Member
Hi, why do I get the error below? Shouldn't it consider the 2nd test? Thanks.

Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning and Data Mining options

SQL> select q'[test]' a from dual;

A
----
test

SQL> select q'[te'st]' a from dual;
ERROR:
ORA-01756: quoted string not properly terminated


Another bug?
Re: Q-quote mechanism [message #352658 is a reply to message #352650] Wed, 08 October 2008 19:45 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
OS?
Cannot reproduce the case in Sun (SPARC, Sun10, Oracle 10.2.0.3
SQL>  select q'[te'st]' a from dual;

A
-----
te'st

Re: Q-quote mechanism [message #352664 is a reply to message #352650] Wed, 08 October 2008 21:00 Go to previous messageGo to next message
Kevin Meade
Messages: 2103
Registered: December 1999
Location: Connecticut USA
Senior Member
Out of curiosity, this is a new syntax for me.

What is it?
What is its advantage over the simpler 'te''st' alterntative?

Thanks, Kevin
Re: Q-quote mechanism [message #352667 is a reply to message #352664] Wed, 08 October 2008 21:29 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
IMHO, Just more convenient. Introduced with 10gR2.
If there are multiple quotes in the string, no need to escape each and every quote.
Re: Q-quote mechanism [message #352686 is a reply to message #352664] Thu, 09 October 2008 00:42 Go to previous messageGo to next message
Michel Cadot
Messages: 68712
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Kevin Meade wrote on Thu, 09 October 2008 04:00
Out of curiosity, this is a new syntax for me.

What is it?
What is its advantage over the simpler 'te''st' alterntative?

Thanks, Kevin

Many programmers know the quoted string syntax allowed in several languages (and many don't know they have to double the apostrophe), it is just a new alternative to write the same thing.

Regards
Michel
Re: Q-quote mechanism [message #352790 is a reply to message #352658] Thu, 09 October 2008 10:59 Go to previous messageGo to next message
ehegagoka
Messages: 493
Registered: July 2005
Senior Member
hi, I've read an article yesterday about the ORACLE_HOME issue being used, can't find again the link now but will keep on searching again. How do I get the OS from sqlplus? I just used the port_string from Tom.

SQL*Plus: Release 9.0.1.0.1 - Production on Thu Oct 9 11:54:21 2008

(c) Copyright 2001 Oracle Corporation.  All rights reserved.

SQL> conn xxx@xxx
Enter password:
Connected.
SQL> select q'[tes't]' a from dual;
ERROR:
ORA-01756: quoted string not properly terminated

SQL> select dbms_utility.port_string from dual;

PORT_STRING
----------------------------------------------------------------------
SVR4-be-64bit-8.1.0

SQL> disconn
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Re: Q-quote mechanism [message #352791 is a reply to message #352790] Thu, 09 October 2008 11:05 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>>SQL*Plus: Release 9.0.1.0.1 - Production on Thu Oct 9 11:54:21 2008
It has to do with your client.
Use at least 9.2.0.8, still some 10g features may not available (using recyclebin for example).
Tested with 9.2.0.8 , it works.
Tested with 9.0.1.X , does not work.

[Updated on: Thu, 09 October 2008 11:07]

Report message to a moderator

Re: Q-quote mechanism [message #352793 is a reply to message #352791] Thu, 09 October 2008 11:13 Go to previous messageGo to next message
ehegagoka
Messages: 493
Registered: July 2005
Senior Member
Now that you've confirmed it, can I asked what's the relation of the client tool? Isn't the database supposed to be the one processing the sql statement? Why is the client tool gets to determine which features are 'valid'? Or did I miss anything here?
Re: Q-quote mechanism [message #352795 is a reply to message #352793] Thu, 09 October 2008 11:18 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>>Why is the client tool gets to determine which features are 'valid'? Or did I miss anything here?

It is the way it is.
You are just using a client tool which is several generations primitive than the database version.
It is not about "validity" of the options. You are just using the wrong tool.
Re: Q-quote mechanism [message #352796 is a reply to message #352795] Thu, 09 October 2008 11:19 Go to previous message
ehegagoka
Messages: 493
Registered: July 2005
Senior Member
Thank you very much!
Previous Topic: Issue with BULK COLLECT and NO_DATA_FOUND
Next Topic: Help Required on SQL tuning
Goto Forum:
  


Current Time: Thu Nov 14 06:02:58 CST 2024