oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.26k stars 1.08k forks source link

missing or invalid option creating table #580

Closed ggrimbert closed 7 years ago

ggrimbert commented 7 years ago

Hi,

I am working on the integration of node-oracledb into sequelize and I'm having an issue :

I can't execute a create table statement without an error. At each time, I got ORA-00922: missing or invalid option

The sql i try to pass is the following, it's ok with sqlplus and sqldeveloper :

CREATE TABLE users (id NUMBER(*,0) GENERATED BY DEFAULT ON NULL AS IDENTITY, createdAt TIMESTAMP NOT NULL, updatedAt TIMESTAMP NOT NULL,CONSTRAINT PKusersid PRIMARY KEY (id));

The call to execute() returns :

Error: ORA-00922: missing or invalid option

    at Error (native)

I am working with nodejs 6.9, Oracle 12c and there is no configuration problem as I am able run my application (which doesn't create tables). Oracledb is in version 1.12.2.

dmcghan commented 7 years ago

@ggrimbert You just need to remove the semicolon from the end of the statement.

ggrimbert commented 7 years ago

This works, thanks !

jagadeesanm-jag commented 5 years ago

I am facing the similar problem while executing the PL/SQL query via the python2.7 using cx_Oracle module . It works in sql developer . But fails with same error ORA-00922 . Could someone please help me on this

SET SERVEROUTPUT ON SIZE 100000 DECLARE match_count INTEGER; v_data_type VARCHAR2(255) :='VARCHAR2'; v_search_string VARCHAR2(4000) :='cc569359-b599-4af6-8fdb-a0ad4ea83f51'; BEGIN FOR t IN (SELECT table_name, column_name FROM all_tab_cols where data_type = v_data_type and table_name like 'TAPI%') LOOP EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM '||t.table_name||' WHERE '||t.column_name||' = :1' INTO match_count USING v_search_string; IF match_count > 0 THEN dbms_output.put_line( t.table_name ||' '||t.column_name||' '||match_count ); END IF; END LOOP; END;

jagadeesanm-jag commented 5 years ago

I tried after removing the semi colons as well , it doesn't help me much .

cjbj commented 5 years ago

@jagadeesanm-jag can you open a new issue and include your actual Node.js code? Review the examples first.