Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Equivalent for [If exists]

3240347May 20 2016 — edited May 20 2016

Hi,

I have a large procedure, so I want to know if I'm right before I will compile it. I have this statement in t-sql:

if exists (select * from Z07_NUM_STREAM where NUM_STREAM_CODE=parm_SEQ_CODE and NEXT_SEQ_NUM<END_SEQ_NUM and parm_PERIOD between STREAM_START_PERD and STREAM_END_PERD) then [..]

and I want to replace 'exists' like that:

declare

  v_if_exists1 integer;

begin

   select count(*)

     into v_if_exists1

     from Z07_NUM_STREAM where NUM_STREAM_CODE=parm_SEQ_CODE and NEXT_SEQ_NUM<END_SEQ_NUM and parm_PERIOD between STREAM_START_PERD and STREAM_END_PERD;

  if v_if_exists1 >= 1

  then [...]

Thanks for reply.

This post has been answered by BluShadow on May 20 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 17 2016
Added on May 20 2016
5 comments
287 views