ora-00911

JDBC: complains about invalid sign but seems fine

老子叫甜甜 提交于 2020-06-23 12:39:10
问题 I have to use JDBC to write to a database (hibernate/ibatis is not an option) and my database is Oracle 11g. I create the following query: insert into user(user_id, username, age, creation_ts) values(seq_userid.NEXTVAL, 'Jack', 19,TO_TIMESTAMP('14/12/2010 15/09/46', 'DD/MM/RR HH24/MI/SS')); However my statetement.execeuteUpdate(above sql) . generates an invalid sign exception. But when I perform the query in squirrel it gets commited just fine. Does anyone know why this is happening? Edit:

ORACLE Batching DDL statements within a Execute Immediate

那年仲夏 提交于 2020-01-02 04:42:07
问题 I'm trying to run multiple ddl statements within one Execute Immediate statement. i thought this would be pretty straight forward but it seems i'm mistaken. The idea is this: declare v_cnt number; begin select count(*) into v_cnt from all_tables where table_name='TABLE1' and owner = 'AMS'; if v_cnt = 0 then execute immediate 'CREATE TABLE TABLE1(VALUE VARCHAR2(50) NOT NULL) ALTER TABLE TABLE1 ADD (MYVAL2 NVARCHAR2(10))'; end if; end; however this results in an error ORA-00911: invalid

Why does running this query with EXECUTE IMMEDIATE cause it to fail?

只愿长相守 提交于 2019-12-17 20:06:10
问题 I am writing a PL/SQL procedure that needs to to dynamically generate some queries, one of which involves creating a temporary table using results from a query taken as a parameter. CREATE OR REPLACE PROCEDURE sqlout(query IN VARCHAR2) IS BEGIN EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE tmp_tab AS (' || query || ');'; END; It compiles correctly, but even with very simple queries such as with: BEGIN sqlout('SELECT * FROM DUAL'); END; IT throws ORA-00911: invalid character . If I run the

Run multiple commands in one ExecuteScalar in Oracle

邮差的信 提交于 2019-12-10 13:42:53
问题 I have a batch of sql statements such as ... insert into.... ; insert into.... ; delete .........; etc When i try to execute them against oracle it gives me this error (ORA-00911 Invalid Character) now i can understand that this is because of the semicolon between the statements, i tried this on SQL Server and it worked but in Oracle no luck so far. Is there a way to run multiple statements against oracle by using the ExecuteScalar or some other function? DUPLICATE : How can I execute

How to include multiple commands in a JDBC SQL query to Oracle 10g?

别说谁变了你拦得住时间么 提交于 2019-12-08 08:34:47
问题 I'm completely new to Oracle (I come from MySQL and MSSQL) and am novice at JDBC. One of my table creation queries looks like this: CREATE TABLE "LISTS" ("ID" NUMBER NOT NULL ENABLE, "NAME" VARCHAR2(1000) NOT NULL ENABLE, "DOMAIN_ID" NUMBER NOT NULL ENABLE, CONSTRAINT "LISTS_PK" PRIMARY KEY ("ID") ENABLE ) / CREATE OR REPLACE TRIGGER "BI_LISTS" before insert on "LISTS" for each row begin select "LISTS_SEQ".nextval into :NEW.ID from dual; end; / ALTER TRIGGER "BI_LISTS" ENABLE / When I try to

ORA-00911: invalid character Toad

馋奶兔 提交于 2019-12-01 09:22:00
I am using Toad 11.5 when I run multiple truncate statement, it gives an error ORA-00911: invalid character truncate table employees; truncate table employees_edit_history; truncate table sourcecontributioncalc; but when I run it one bye one , it execute successfully! Why toad giving an error when I run all statements once? and any solution for that ? When you run it as a statement (F9) you can't have multiple statements, and the semicolons are meaningless - as they are statement separators. (You get the same error with a semicolon in an execute immediate or JDBC call, for example, as they

Why does running this query with EXECUTE IMMEDIATE cause it to fail?

江枫思渺然 提交于 2019-11-28 12:11:10
I am writing a PL/SQL procedure that needs to to dynamically generate some queries, one of which involves creating a temporary table using results from a query taken as a parameter. CREATE OR REPLACE PROCEDURE sqlout(query IN VARCHAR2) IS BEGIN EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE tmp_tab AS (' || query || ');'; END; It compiles correctly, but even with very simple queries such as with: BEGIN sqlout('SELECT * FROM DUAL'); END; IT throws ORA-00911: invalid character . If I run the created query manually it runs correctly. At this point I am able to determine what is causing the