DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: variables in if conditions

Threaded View

  1. #1
    Join Date
    Mar 2001
    Location
    south africa
    Posts
    401

    variables in if conditions

    can we use variables in if conditions
    if( 0 <> P_COMPANY_ID ) and
    (P_COMPANY_ID = COMPANY_ID)

    if( 0 <> P_JOB_ID )
    (P_JOB_ID = CODING_JOB_ID)


    or use variables to assign some thing in SQL stmt

    select CODING_JOB_ID, PATH
    from CODING_JOBS
    where CODING_STAGE_ID in (2,6)
    and "" <> P_RESERVED_CODER_ID
    and (P_RESERVED_CODER_ID = RESERVED_CODER_ID)


    here is the actual code where
    FUNCTION FN_AVAILABLE
    ( P_USER_ID in USERS.MEMBER%TYPE
    ,P_PASSWORD in MEMBERS.password%TYPE
    ,P_RESERVED_CODER_ID in USERS.MEMBER%TYPE
    ,P_JOB_ID in CODING_JOBS.CODING_JOB_ID%TYPE
    ,P_COMPANY_ID in CODING_JOBS.COMPANY_ID%TYPE
    )
    RETURN RECORDSET IS
    Result RECORDSET;
    BEGIN
    L_MT_ID = PA_C.FN_MID( P_USER_ID);
    if PA_wc.f_VMt( L_MT_ID, P_PASSWORD) then

    --OPEN Result FOR
    select CODING_JOB_ID,
    PATH
    from CODING_JOBS
    where CODING_STAGE_ID in (2,6)
    and ( RESERVED_CODER_ID=" " OR P_RESERVED_CODER_ID = RESERVED_CODER_ID)
    and (COMPANY_ID=0 OR P_COMPANY_ID = COMPANY_ID)
    and (CODING_JOB_ID=0 OR P_JOB_ID = CODING_JOB_ID);

    end if;

    return( Result);

    END FN_AVAILABLE;

    in the above sql stmt i would like to assign values to variables
    Is this works!!

    any help is much appreciated
    Last edited by prodadmin; 08-20-2004 at 08:41 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width