Re: DBD ERROR: error possibly near <*> indicator at char
by Lhamo Latso (Scribe) on Sep 17, 2010 at 21:35 UTC
|
ora-00942 table or view does not exist. You should change your statement to something simple like:
"select ss from prod where rownum < 2"
Paul | [reply] |
Re: DBD ERROR: error possibly near <*> indicator at char
by ikegami (Patriarch) on Sep 17, 2010 at 19:46 UTC
|
Could it be that test is a keyword? If so, you'll need to properly quote it. (I don't happen to know how to quote identifiers in Oracle.)
Update: On second thought, not likely.
| [reply] [d/l] |
|
|
test is not a keyword but i changed my table name from test to prod...
| [reply] |
Re: DBD ERROR: error possibly near <*> indicator at char
by Anonymous Monk on Sep 17, 2010 at 23:24 UTC
|
Hi
What happens if you take the statement and run it
in SQLPlus?
J.C.
| [reply] |
|
|
SQL statment runs and insert the requred input in the table , so SQL statment is not a problem
I can make it simpler by doing
Insert into prod (ss)
select max_ss + 1 FROM (SELECT MAX (ss)
max_ss FROM prod)
| [reply] [d/l] |
|
|
Better to use a sequence:
create or replace sequence prod_seq minvalue 1 nomaxvalue start with x
+xxx increment by 1 cache 20 noorder nocycle
Then your insert select can use the nextval function:
insert into prod (ss)
select prod_seq.nextval from dual
You need to create the sequence only once, but be sure to set the "start with xxxx" to a value higher than anything in your table.
Paul
| [reply] [d/l] [select] |
|
|
Re: DBD ERROR: error possibly near <*> indicator at char
by runrig (Abbot) on Sep 21, 2010 at 14:32 UTC
|
Take a step back. What happens if you just run the SELECT part of the statement? | [reply] |
|
|
$sth = $dbh->prepare(qq{
INSERT INTO people (fullname, age) VALUES (?, ?)
});
Would that make any difference
| [reply] [d/l] [select] |
|
|
| [reply] |
Re: DBD ERROR: error possibly near <*> indicator at char
by bart (Canon) on Sep 21, 2010 at 16:11 UTC
|
I just tested the following code in Oracle Express, and it works: a new row is inserted. The database is on my local machine. Note that AutoCommit is true.
use DBI;
my $dd = DBI->connect('dbi:Oracle:', 'scott', 'tiger',
{ RaiseError => 1, PrintError => 0 });
my $sth = $dd->prepare("insert into prod (ss) select 1+max(ss) from pr
+od");
$sth->execute;
$dd->disconnect;
So, I see no conceptual reason why it shouldn't work. | [reply] [d/l] [select] |
|
|
| [reply] |
Re: DBD ERROR: error possibly near <*> indicator at char
by runrig (Abbot) on Oct 18, 2010 at 17:17 UTC
|
Please don't erase questions. Add updates, clarify, say "I still don't know what's going on", but don't delete everything... | [reply] |