0
我已經在PostgreSQL中創建一個存儲過程如下:org.postgresql.util.PSQLException:ERROR:空值列「的order_id」違反了非空約束
INSERT INTO ABC
(order_id,order_dt, customer_id, route_id, routenum, ordertype, create_station_id, create_stationtype, create_time,create_user_id,tran_time, tran_user_id,station_id)
values
(1,$1, $2, $3, $4, $5, $6, $7, LOCALTIMESTAMP, $8,
default, default,$9)
returning order_id;
有order_id
是SERIAL
類型 -
PSQLException: ERROR: null value in column "order_id" violates not-null constraint Where: SQL function "insert_ABC" statement 1.
我使用PostgreSQL 8.2
:>primary key
我同時插入如下得到錯誤。這是在我正在做這個主機空間。
我知道錯誤發生,因爲默認類型默認爲空。
什麼是SERIAL
類型的default
的等效值。
請指導我。
'default'不會工作,因爲它越來越'NULL'值,這裏'order_id'是一個主鍵,而不是空。 – Santhucool
@Santhucool分享表CREATE SQL。 – lad2025