Re: inserting data into Oracle tables

From: Date: Fri, 09 Dec 2005 14:22:27 +0000
Subject: Re: inserting data into Oracle tables
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-40829@lists.php.net to get a copy of this message
Hi David, Am Fr 9.Dezember 2005 11:00 schrieb David Skyers: > Is there a standard for inserting data into Oracle tables from a user input > field in PHP? > > Most Oracle tables will have a limit on the amount characters such as > > Name VARCHAR2(60 BYTE) - this means the maximum amount of characters > allowed is 60. > > If you use special characters in PHP such as entering the following into a > input box > > ¬!"£$%^&*()_+{}@~<>?|\,./;'#][=-¦abcdefghijklmnopqrstuvwxyzA > > When this gets passed to Oracle it takes the overall characters in the > insert statement to 64, which then fails because it is over the Oracle > table limit. Is there a standard way of dealing with something like this. your problem description sounds to me as you use a character encoding that uses for 4 of your test chars a 2byte code and for the other chars a 1 byte encoding. I don't know a standard way, i think you can look into your encoding table that you use into your oracle db (nls_language parameter) and count the bytes in a selfmade procedure before you sent to oracle ... afair if you use a utf8 or similiar international encoding the newer versions of oracle count a charachter as 1 element in your VARCHAR2 definition and not as bytes. regards, Falk

« previous php.db (#40829) next »