develooper Front page | perl.dbi.users | Postings from February 2019

RE: Translate between DBI and SQL

Thread Previous | Thread Next
Fennell, Brian
February 11, 2019 16:48
RE: Translate between DBI and SQL
Message ID:

My last answer used single-quote for a column with a space in it in PostgreSQL - this is wrong, it should have been a double-quote for the name of the column with a space and a single quote for a quoted string literal in PostgreSQL.

Better example:

(Adapted from answer to question here

$my_perl_sql_string= 'SELECT' . "\n";
$my_perl_sql_string.= '   tab."This IS My Column EXACTLY" AS col' . "\n";
$my_perl_sql_string.= 'FROM "My TabLE Name Contains Spaces Too!" tab' . "\n";
$my_perl_sql_string.= 'WHERE tab."ANOTHER UGLY COLUMN name" = \'MyFilterString\'    '

I don't know if PostgreSQL requires a trailing semi-colon when used in DBI/DBD or not.
I know that Oracle SQL requires a trailing semicolon in sqlplus but not in DBI/DBD.
I don't have a PostgreSQL database to try it out on.

Try it both ways, and the one that works is the one to use.

Brian Fennell

The information contained in this electronic mail transmission is intended only for the use of the individual or entity named in this transmission. If you are not the intended recipient of this transmission, you are hereby notified that any disclosure, copying or distribution of the contents of this transmission is strictly prohibited and that you should delete the contents of this transmission from your system immediately. Any comments or statements contained in this transmission do not necessarily reflect the views or position of Radial or its subsidiaries and/or affiliates.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About