PL/SQL (MOSC)

MOSC Banner

running Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production. Getting diffe

edited Sep 6, 2018 5:03AM in PL/SQL (MOSC) 6 commentsAnswered

The following pl/sql and sql return different results in 2 different oracle 12 databasses.

create or replace function x(EMPLID in varchar) return number is

        isCCCstudent number;

begin

isCCCstudent := 0.00;

        SELECT count(*) INTO isCCCstudent FROM ps_acad_prog ap WHERE ap.emplid = Emplid AND ap.acad_prog = 'CCC' AND ap.prog_status = 'AC' ;

 

return iscccstudent;

end;

/

select x('000188430') from dual;

/

SELECT count(*)  FROM ps_acad_prog ap WHERE ap.emplid = '000188430' AND ap.acad_prog = 'CCC' AND ap.prog_status = 'AC';

/

in one database I get

Function created.

X('000188430')

--------------

             1

1 row selected.

  COUNT(*)

----------

         0

1 row selected.

which is wrong.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center