Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 07: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, 12: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, 06: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

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