207: p_organization_id IN number) is
208:
209: cursor c_first_operation is
210: select min(operation_seq_num)
211: from wip_operations
212: where organization_id = p_organization_id
213: and wip_entity_id = p_wip_entity_id;
214:
215: cursor c_ml_invalid_rows is
228: and wjdi.operation_seq_num <> 1
229: )
230: )
231: and not exists (select 1
232: from wip_operations wo
233: where wjdi.wip_entity_id = wo.wip_entity_id
234: and wjdi.organization_id = wo.organization_id
235: and wjdi.operation_seq_num = wo.operation_seq_num);
236:
251: and wjdi.operation_seq_num <> 1
252: )
253: )
254: and not exists (select 1
255: from wip_operations wo
256: where wjdi.wip_entity_id = wo.wip_entity_id
257: and wjdi.organization_id = wo.organization_id
258: and wjdi.operation_seq_num = wo.operation_seq_num);
259:
356: and operation_seq_num <> 1
357: )
358: )
359: and not exists (select 1
360: from wip_operations wo
361: where wjdi.wip_entity_id = wo.wip_entity_id
362: and wjdi.organization_id = wo.organization_id
363: and wjdi.operation_seq_num = wo.operation_seq_num);
364: else
377: and operation_seq_num <> 1
378: )
379: )
380: and not exists (select 1
381: from wip_operations wo
382: where wjdi.wip_entity_id = wo.wip_entity_id
383: and wjdi.organization_id = wo.organization_id
384: and wjdi.operation_seq_num = wo.operation_seq_num);
385: end if;