Trouble with exception
| От | samantha mahindrakar |
|---|---|
| Тема | Trouble with exception |
| Дата | |
| Msg-id | f0c828c40806060729k7de49b2fsfc20e648dff8bb8a@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: Trouble with exception
|
| Список | pgsql-sql |
Hi....
Iam trying to insert records into a table......when an integrity
constarint violation occurs the exception is caught........but i dont
want the whole thing to be rolled back or stopped because of one
exception. The insert statement is as follows:
'INSERT INTO '||imputation_table||' (SELECT
lane_id,speed,volume,occupancy,quality,measurement_start,measurement_end,effective_date,expiration_date
FROM '||partitionname||' WHERE lane_id IN(select lane_id from lane_info where inactive is
null )AND (volume=255 OR speed=255 OR occupancy=255 OR occupancy>=100
OR volume>52 OR volume<0 OR speed>120 OR speed<0) AND date_part(''hour'', measurement_start) between 5 and 23
ANDdate_part(''day'',measurement_start)='||theDate||')';
EXCEPTION WHEN integrity_constraint_violation THENRAISE NOTICE 'Imputation for lane at time has been already
imputed';
Is there a way i can just skip the record that causes the violation
and insert the rest of the records into the table???
Thanks
Sam
В списке pgsql-sql по дате отправления: