Home » SQL & PL/SQL » SQL & PL/SQL » problem in inserting as well as selecting
problem in inserting as well as selecting [message #366386] Sat, 13 December 2008 04:17 Go to next message
panyam
Messages: 146
Registered: May 2008
Senior Member
Hi All,

I am not able to view the string i have inserted ( string with special characters in it . - ,' , %, $,^etc).

below is what i hav done

SQL> CREATE TABLE TESTING (
  2  I NUMBER,
  3  NAME VARCHAR2(20),
  4  PWD  VARCHAR2(30));

Table created.

SQL> VAR VAR_NAME VARCHAR2(20);
SQL> DEFINE VAR_NAME='''ERER'''

SQL> ED
Wrote file afiedt.buf

  1* INSERT INTO TESTING VALUES ( 10,: VAR_NAME ,'fDFDF')
SQL> /

1 row created.

SQL> SELECT * fROM TESTING;

         I NAME                 PWD
---------- -------------------- ------------------------------
        10                      fDFDF


also i hav the following issue.

here passedvariable is the variable i am passing from java.


select passwd from table1 where ename=[I]passedvariable[/I]


now suppose if i pass passedvariable as
'1' or 'true'


the query fails to work as expected.

How to check for Exact matching of the string which contains special characters(includes - ,' , %, $,^etc).

hope you understand the issue.
Re: problem in inserting as well as selecting [message #369636 is a reply to message #366386] Sat, 13 December 2008 09:03 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ You make a confusion between bind variable and substitution variable. Have a look at SQL*PlusŪ User's Guide and Reference

2/ Read Database JDBC Developer's Guide and Reference, Chapter 13 Accessing and Manipulating Oracle Data to know how to use Java variables in SQL.

Regards
Michel
Re: problem in inserting as well as selecting [message #375801 is a reply to message #366386] Sun, 14 December 2008 22:22 Go to previous messageGo to next message
panyam
Messages: 146
Registered: May 2008
Senior Member

Hi Michel,

Thnks For the Reply..I know tht using Prepared statement we can eliminate the problem (2) in java. How can we handle the issue in oracle ?...how to do exact string matching ?...( string with ', -, %," )
Re: problem in inserting as well as selecting [message #375815 is a reply to message #375801] Mon, 15 December 2008 00:44 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Which issue? there is no issue with any character if you use a bind variable.

Regards
Michel
Re: problem in inserting as well as selecting [message #375824 is a reply to message #366386] Mon, 15 December 2008 01:09 Go to previous message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
try with chr(ascii value) while comparing
yours
dr.s.raghunathan
Previous Topic: Extension of UTL_File
Next Topic: Difference between first reading and second reading?
Goto Forum:
  


Current Time: Sat Dec 10 01:35:11 CST 2016

Total time taken to generate the page: 0.25224 seconds