Обсуждение: what is wrong with this SQL?

Поиск
Список
Период
Сортировка

what is wrong with this SQL?

От
kornale@zdnetmail.com (Alex K.)
Дата:
create table USERS (
    ID                decimal(19)    CONSTRAINT primary_usr_oid    PRIMARY KEY,
    WRITE_COUNT            decimal(19)    NOT NULL,
    CLASS                decimal(10)    NOT NULL,
    STATUS                decimal(3)    NOT NULL,
    USR_LOGIN_USER_ID        varchar2(16)    ,
    USR_PASSWORD            varchar2(16)    ,
    USR_PERSON_FIRST_NAME        varchar(32)    ,
    USR_PERSON_MIDDLE_NAME        varchar(32)    ,
    USR_PERSON_LAST_NAME        varchar(32)    ,
    USR_PERSON_SALUTATION        varchar(32)    ,
    USR_PERSON_SUFFIX        varchar(32)
);

when i am in psql and i do: \i createUsersTable.sql i get this error:
psql:createUsersTable.sql:13: ERROR:  parser: parse error at or near "("

What is this?

Re: what is wrong with this SQL?

От
"Vladimir Konrad"
Дата:
USR_LOGIN_USER_ID varchar2(16) ,
USR_PASSWORD varchar2(16) ,

There is not varchar2 type!

regards...

Alex K. <kornale@zdnetmail.com> wrote in message
news:99fb7937.0109201418.7ff032a2@posting.google.com...
> create table USERS (
> ID decimal(19) CONSTRAINT primary_usr_oid PRIMARY KEY,
> WRITE_COUNT decimal(19) NOT NULL,
> CLASS decimal(10) NOT NULL,
> STATUS decimal(3) NOT NULL,
> USR_LOGIN_USER_ID varchar2(16) ,
> USR_PASSWORD varchar2(16) ,
> USR_PERSON_FIRST_NAME varchar(32) ,
> USR_PERSON_MIDDLE_NAME varchar(32) ,
> USR_PERSON_LAST_NAME varchar(32) ,
> USR_PERSON_SALUTATION varchar(32) ,
> USR_PERSON_SUFFIX varchar(32)
> );
>
> when i am in psql and i do: \i createUsersTable.sql i get this error:
> psql:createUsersTable.sql:13: ERROR:  parser: parse error at or near "("
>
> What is this?



Re: what is wrong with this SQL?

От
Keary Suska
Дата:
Is 'varchar2' a proper user-defined type?

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

> From: kornale@zdnetmail.com (Alex K.)
> Organization: http://groups.google.com/
> Date: 20 Sep 2001 15:18:46 -0700
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] what is wrong with this SQL?
>
> create table USERS (
> ID                decimal(19)    CONSTRAINT primary_usr_oid    PRIMARY KEY,
> WRITE_COUNT            decimal(19)    NOT NULL,
> CLASS                decimal(10)    NOT NULL,
> STATUS                decimal(3)    NOT NULL,
> USR_LOGIN_USER_ID        varchar2(16)    ,
> USR_PASSWORD            varchar2(16)    ,
> USR_PERSON_FIRST_NAME        varchar(32)    ,
> USR_PERSON_MIDDLE_NAME        varchar(32)    ,
> USR_PERSON_LAST_NAME        varchar(32)    ,
> USR_PERSON_SALUTATION        varchar(32)    ,
> USR_PERSON_SUFFIX        varchar(32)
> );
>
> when i am in psql and i do: \i createUsersTable.sql i get this error:
> psql:createUsersTable.sql:13: ERROR:  parser: parse error at or near "("
>
> What is this?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>


Re: what is wrong with this SQL?

От
Stephan Szabo
Дата:
On 20 Sep 2001, Alex K. wrote:

> create table USERS (
>     ID                decimal(19)    CONSTRAINT primary_usr_oid    PRIMARY KEY,
>     WRITE_COUNT            decimal(19)    NOT NULL,
>     CLASS                decimal(10)    NOT NULL,
>     STATUS                decimal(3)    NOT NULL,
>     USR_LOGIN_USER_ID        varchar2(16)    ,
>     USR_PASSWORD            varchar2(16)    ,
>     USR_PERSON_FIRST_NAME        varchar(32)    ,
>     USR_PERSON_MIDDLE_NAME        varchar(32)    ,
>     USR_PERSON_LAST_NAME        varchar(32)    ,
>     USR_PERSON_SALUTATION        varchar(32)    ,
>     USR_PERSON_SUFFIX        varchar(32)
> );
>
> when i am in psql and i do: \i createUsersTable.sql i get this error:
> psql:createUsersTable.sql:13: ERROR:  parser: parse error at or near "("
>
> What is this?

What is varchar2?  It's probably complaining that it has a type that
isn't there followed by a () size spec and gets confused at that point.



Re: what is wrong with this SQL?

От
"Vladimir Konrad"
Дата:
USR_LOGIN_USER_ID varchar2(16) ,
USR_PASSWORD varchar2(16) ,

There is not varchar2 type!

regards...

Alex K. <kornale@zdnetmail.com> wrote in message
news:99fb7937.0109201418.7ff032a2@posting.google.com...
> create table USERS (
> ID decimal(19) CONSTRAINT primary_usr_oid PRIMARY KEY,
> WRITE_COUNT decimal(19) NOT NULL,
> CLASS decimal(10) NOT NULL,
> STATUS decimal(3) NOT NULL,
> USR_LOGIN_USER_ID varchar2(16) ,
> USR_PASSWORD varchar2(16) ,
> USR_PERSON_FIRST_NAME varchar(32) ,
> USR_PERSON_MIDDLE_NAME varchar(32) ,
> USR_PERSON_LAST_NAME varchar(32) ,
> USR_PERSON_SALUTATION varchar(32) ,
> USR_PERSON_SUFFIX varchar(32)
> );
>
> when i am in psql and i do: \i createUsersTable.sql i get this error:
> psql:createUsersTable.sql:13: ERROR:  parser: parse error at or near "("
>
> What is this?



Re: what is wrong with this SQL?

От
"zammon@libero.it"
Дата:
Hi Alex,
You are using the non standard  VARCHAR2 data type, only Oracle uses
this data type I wonder to know
the difference between VARCHAR and VARCHAR2, anyway try to change it to
VARCHAR.

I hope this help you.
Jose

Alex K. wrote:

>create table USERS (
>    ID                decimal(19)    CONSTRAINT primary_usr_oid    PRIMARY KEY,
>    WRITE_COUNT            decimal(19)    NOT NULL,
>    CLASS                decimal(10)    NOT NULL,
>    STATUS                decimal(3)    NOT NULL,
>    USR_LOGIN_USER_ID        varchar2(16)    ,
>    USR_PASSWORD            varchar2(16)    ,
>    USR_PERSON_FIRST_NAME        varchar(32)    ,
>    USR_PERSON_MIDDLE_NAME        varchar(32)    ,
>    USR_PERSON_LAST_NAME        varchar(32)    ,
>    USR_PERSON_SALUTATION        varchar(32)    ,
>    USR_PERSON_SUFFIX        varchar(32)
>);
>
>when i am in psql and i do: \i createUsersTable.sql i get this error:
>psql:createUsersTable.sql:13: ERROR:  parser: parse error at or near "("
>
>What is this?
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html
>




Re: what is wrong with this SQL?

От
Doug McNaught
Дата:
kornale@zdnetmail.com (Alex K.) writes:

>     USR_LOGIN_USER_ID        varchar2(16)    ,
>     USR_PASSWORD            varchar2(16)    ,

> when i am in psql and i do: \i createUsersTable.sql i get this error:
> psql:createUsersTable.sql:13: ERROR:  parser: parse error at or near "("

My previous mail was wrong, its the "varchar2" that's messing things
up--PG has no such type.  The error message isn't too helpful.

Change it to "text" or regular "varchar" and you should be OK.

-Doug
--
In a world of steel-eyed death, and men who are fighting to be warm,
Come in, she said, I'll give you shelter from the storm.    -Dylan

Re: what is wrong with this SQL?

От
Doug McNaught
Дата:
kornale@zdnetmail.com (Alex K.) writes:

> create table USERS (
>     ID                decimal(19)    CONSTRAINT primary_usr_oid    PRIMARY KEY,
>     WRITE_COUNT            decimal(19)    NOT NULL,
>     CLASS                decimal(10)    NOT NULL,
>     STATUS                decimal(3)    NOT NULL,

> when i am in psql and i do: \i createUsersTable.sql i get this error:
> psql:createUsersTable.sql:13: ERROR:  parser: parse error at or near "("

PostgreSQL DECIMAL doesn't take a size argument.  Take out the sizes
and you'll be good.

-Doug
--
In a world of steel-eyed death, and men who are fighting to be warm,
Come in, she said, I'll give you shelter from the storm.    -Dylan

Re: what is wrong with this SQL?

От
Thomas Lockhart
Дата:
...
> PostgreSQL DECIMAL doesn't take a size argument.  Take out the sizes
> and you'll be good.

That doesn't seem to be a problem:

lockhart=# create table t1 (d decimal(19) not null);
CREATE

                    - Thomas

Re: what is wrong with this SQL?

От
"Andy Hallam"
Дата:
The difference between VARCHAR and VARCHAR2 in ORACLE is that VARCHAR2 is
ORACLE's UNICODE character data type - equiv to NCHAR in PostgreSQL.

Andy.

<zammon@libero.it> wrote in message news:3BB380F9.7000106@libero.it...
> Hi Alex,
> You are using the non standard  VARCHAR2 data type, only Oracle uses
> this data type I wonder to know
> the difference between VARCHAR and VARCHAR2, anyway try to change it to
> VARCHAR.
>
> I hope this help you.
> Jose
>
> Alex K. wrote:
>
> >create table USERS (
> > ID decimal(19) CONSTRAINT primary_usr_oid PRIMARY KEY,
> > WRITE_COUNT decimal(19) NOT NULL,
> > CLASS decimal(10) NOT NULL,
> > STATUS decimal(3) NOT NULL,
> > USR_LOGIN_USER_ID varchar2(16) ,
> > USR_PASSWORD varchar2(16) ,
> > USR_PERSON_FIRST_NAME varchar(32) ,
> > USR_PERSON_MIDDLE_NAME varchar(32) ,
> > USR_PERSON_LAST_NAME varchar(32) ,
> > USR_PERSON_SALUTATION varchar(32) ,
> > USR_PERSON_SUFFIX varchar(32)
> >);
> >
> >when i am in psql and i do: \i createUsersTable.sql i get this error:
> >psql:createUsersTable.sql:13: ERROR:  parser: parse error at or near "("
> >
> >What is this?
> >
> >---------------------------(end of broadcast)---------------------------
> >TIP 5: Have you checked our extensive FAQ?
> >
> >http://www.postgresql.org/users-lounge/docs/faq.html
> >
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html