Обсуждение: Insert error

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

Insert error

От
Atif Jung
Дата:
The following lines inserts a row into table pending_file
 
 +1757          /* Add a row to pending_file */
 +1758          EXEC SQL INSERT INTO pending_file
 +1759          (submission_no, orc, terminal_id, initials, user_id, output_to_file, output_path, item_id)
 +1760          VALUES (:sSubNo, :sORC, :sTermID, :sInit, :sUserID, "1", :sOutPath, :sItemID);
 
The table definition in postgres is:
 
     Column      |          Type          | Modifiers
-----------------+------------------------+-----------
 submission_no   | character(11)           | not null
 item_id              | character(9)             | not null
 terminal_id         | character(3)             |
 initials               | character(2)              |
 user_id              | character(20)            |
 orc                    | character(1)              |
 output_to_file     | character(1)               |
 output_path       | character varying(200) |
 gui_calling         | character(1)               |
 date                  | date                          |
 calling_process  | integer                      |
 
The error being recorded by sqlca.sqlerrm.sqlerrmc is:
 
column "1" does not exist on line 1758.
 
I'm totally baffled, can anyone kindly explain what the error is referring to?
 
Thanks

Atif


Re: Insert error

От
"A. Kretschmer"
Дата:
In response to Atif Jung :
> The following lines inserts a row into table pending_file
>  
>  +1757          /* Add a row to pending_file */
>  +1758          EXEC SQL INSERT INTO pending_file
>  +1759          (submission_no, orc, terminal_id, initials, user_id,
> output_to_file, output_path, item_id)
>  +1760          VALUES (:sSubNo, :sORC, :sTermID, :sInit, :sUserID, "1",
>  
> The error being recorded by sqlca.sqlerrm.sqlerrmc is:
>  
> column "1" does not exist on line 1758.

You should use " for identifier, nor for constants. You want to insert
an constant, so you should use ' instead of ".


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

Re: Insert error

От
Mladen Gogala
Дата:
Atif Jung wrote:
> The following lines inserts a row into table pending_file
>
>  +1757          /* Add a row to pending_file */
>  +1758          EXEC SQL INSERT INTO pending_file
>  +1759          (submission_no, orc, terminal_id, initials, user_id,
> output_to_file, output_path, item_id)
>  +1760          VALUES (:sSubNo, :sORC, :sTermID, :sInit, :sUserID,
> "1", :sOutPath, :sItemID);
>
> The table definition in postgres is:
>
>      Column      |          Type          | Modifiers
> -----------------+------------------------+-----------
>  submission_no   | character(11)           | not null
>  item_id              | character(9)             | not null
>  terminal_id         | character(3)             |
>  initials               | character(2)              |
>  user_id              | character(20)            |
>  orc                    | character(1)              |
>  output_to_file     | character(1)               |
>  output_path       | character varying(200) |
>  gui_calling         | character(1)               |
>  date                  | date                          |
>  calling_process  | integer                      |
>
> The error being recorded by sqlca.sqlerrm.sqlerrmc is:
>
> column "1" does not exist on line 1758.
>
> I'm totally baffled, can anyone kindly explain what the error is
> referring to?
>
> Thanks
>
> Atif
>
>

Strings are surrounded by single quotes, identifiers by double quotes.
String is 'I', column name is "I".

--
Mladen Gogala
Sr. Oracle DBA
1500 Broadway
New York, NY 10036
(212) 329-5251
www.vmsinfo.com