ora-01400

Handle ORACLE Exceptions

半世苍凉 提交于 2019-12-23 07:59:39
问题 I need to handle the ORA-01400 error (cannot insert NULL into ("SCHEMA"."TABLE_NAME"."COLUMN_NAME") ) using a exception handle. ORACLE Predefine a few Exceptions like (ACCESS_INTO_NULL, ZERO_DIVIDE and so on), but apparently does not define an Exception for the ORA-01400 error, how do I handle this particular error code? I need something like this (other suggestions are accepted). .... ... INSERT INTO MY_TABLE (CODE, NAME) VALUES (aCode,aName); COMMIT; EXCEPTION WHEN NULL_VALUES THEN /* i don

Rails modeling: converting HABTM to has_many :through

冷暖自知 提交于 2019-12-12 10:57:23
问题 I'm doing maintenance work on an existing Rails site and am having some problems stemming from many-to-many associations. It looks like the site was initially built using has_and_belongs_to_many for a few relationships that have since gotten more complicated in the business logic, so I need to use has_many :through instead to support additional fields in the relationship table. However, the join table that was initially used for HABTM doesn't have a primary key, and I've got to add one to

one-to-many relationshipt with database constrain and inverse=true

柔情痞子 提交于 2019-12-08 04:09:12
问题 There are two classes A and B and hibernate mappings <hibernate-mapping default-lazy="false"> <class name="A" table="A"> <id name="id" type="long"> <generator class="sequence"><param name="sequence">A_SEQUENCE</param></generator></id> <set name="a" cascade="all" inverse="false" > <key><column name="A_FK" not-null="true" /></key> <one-to-many class="B" /></set> </class> </hibernate-mapping> <hibernate-mapping default-lazy="false"> <class name="B" table="B"> <id name="id" type="long"> <column

Oracle - Error: 'ORA-01400: cannot insert NULL into

断了今生、忘了曾经 提交于 2019-12-07 21:20:02
问题 I'm trying to insert a record into a table, but getting the error - 'ORA-01400: cannot insert NULL into (....'. The table structure is: I migrate from Mysql to Oracle. On Mysql this works, but on Oracle it is not working. How can I fix this? Do I need write all column insert query or unselect not null option 回答1: Try this: create or replace trigger EDITIONS_COR before insert or update on EDITIONS for each row begin if INSERTING then select EDITIONS_SEQ.nextval into :new.ID from DUAL; end if;

Oracle - Error: 'ORA-01400: cannot insert NULL into

人盡茶涼 提交于 2019-12-06 06:19:53
I'm trying to insert a record into a table, but getting the error - 'ORA-01400: cannot insert NULL into (....'. The table structure is: I migrate from Mysql to Oracle. On Mysql this works, but on Oracle it is not working. How can I fix this? Do I need write all column insert query or unselect not null option user3546225 Try this: create or replace trigger EDITIONS_COR before insert or update on EDITIONS for each row begin if INSERTING then select EDITIONS_SEQ.nextval into :new.ID from DUAL; end if; :new.CORDATE:=SYSDATE; :new.USERNAME:=USER; end; 来源: https://stackoverflow.com/questions