Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle 10g - Escape quote in insert statement

I am trying to insert people's height into a database in the form of 5'9

How do I properly escape the quote so I can do this. My insert statement looks like this so far.

INSERT INTO height(id, height) 
VALUES(height-seq.nexval, '5\'9');

The backslash does not work obviously and I am pretty new to oracle. Thanks

like image 720
oracleNewb Avatar asked Jan 28 '26 17:01

oracleNewb


2 Answers

Oracle uses standard SQL:

INSERT INTO height(id, height) 
VALUES(height-seq.nexval, '5''9');

(Yes there are two single quotes)

if you are doing this from a front end using some programming language, consider using a parametrized query, if you are in psql or some other tool to do this, just use '5''9 ' and it will work fine

like image 34
Prashant Lakhlani Avatar answered Jan 31 '26 07:01

Prashant Lakhlani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!