If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Apostrophes problem using ASP and Oracle

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-10-03, 06:53
johnstv3 johnstv3 is offline
Registered User
 
Join Date: Mar 2003
Posts: 20
Apostrophes problem using ASP and Oracle

Hi everyone,

I'm having extreme difficulties in getting a stored procedure to work. I am passing string values from a web page to the following procedure which updates a table in an Oracle db.


var cmd = Server.CreateObject("ADODB.Command");
cmd.ActiveConnection = Application("bmcmaindb");

var param1 = cmd.CreateParameter("text1", adChar, adParamInput, 4000);

var param2 = cmd.CreateParameter("text2", adChar, adParamInput, 4000);

cmd.Parameters.Append(param1);
cmd.Parameters.Append(param2);

cmd.Parameters("text1") = param1;
cmd.Parameters("text2") = param2;

cmd.CommandText = "{CALL my_pkg.my_proc(?,?) }";

cmd.CommandType = adCmdText;
cmd.Execute();

cmd = null;


The trouble here is that it is knocking off text after any apostrophe within both of the parameters. Does anyone know why?


Regards,

John
Reply With Quote
  #2 (permalink)  
Old 04-10-03, 11:25
gannet gannet is offline
Registered User
 
Join Date: Oct 2002
Location: Plymouth UK
Posts: 116
The reason for this that Oracle sees the apostrophe as the end of the field. To enter apostrophe's into the Oracle database you need to double up the apostrophe in the string, so that Oracle processes see it as an apostrophe rather than the end of the field.
Reply With Quote
  #3 (permalink)  
Old 04-11-03, 05:18
HansMij HansMij is offline
Registered User
 
Join Date: Apr 2003
Posts: 1
Just Escape the variables when you're putting them into the database. UnEscape them when you're reading them out of your database.


OK, it's pretty irritating, but it works.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On