CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Create Table Statement causing problem in DBD

 



vinod236
New User

May 9, 2008, 3:37 AM

Post #1 of 3 (708 views)
Create Table Statement causing problem in DBD Can't Post

Hi all,

I want to create a duplicate table of some original table.For that i am using below.

#**************************************

use strict;
use DBI;
my $dbh = DBI->connect("dbi:Oracle:host=192.168.10.150;sid=MyDB",
'vinod_aa','vinod_aa', {RaiseError => 1, AutoCommit => 1})
or die "Can't connect to database $DBI::errstr\n";


my $sql = 'create table Table_name as(select * from Sample_table where i =?)'; my my $i = $dbh->prepare($sql_query);
$i->execute();

#**********************************************

but when i execute this code its throws a error ( ie DBDB::Oracle::st Execute failed :ORA-01036 :illegal virable name/number (DBDError::OCIBindbyname) For stastement "Create table")

Any idea why this error is coming?


KevinR
Veteran


May 9, 2008, 12:03 PM

Post #2 of 3 (706 views)
Re: [vinod236] Create Table Statement causing problem in DBD [In reply to] Can't Post

I assume it is coming from here:

$sql = 'create table
-------------------------------------------------


winfinit
User

May 9, 2008, 11:36 PM

Post #3 of 3 (700 views)
Re: [vinod236] Create Table Statement causing problem in DBD [In reply to] Can't Post

that is not valid request

you are using this query
create table Table_name as(select * from Sample_table where i =?
but where are you replacing ? with actual data? or you didnt include that portion?

also i would look into COPY syntax of sqlplus, i think that would be more appropriate to use in your situation.

and either your code was just dropped and not meant to have a correct syntax, or you are missing some portion here, since you are naming your query $sql and in prepare you are doing $sql_query and once again in execute you are not including data that should be replacing ?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives