SHARE
TWEET

Untitled

a guest May 21st, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create or replace FUNCTION  getValoare(  
  2. id in int,what in VARCHAR)  
  3. return float  
  4. AS  
  5. last_value float;  
  6. BEGIN  
  7. if phanalyse(id)=0 then return 0;  
  8. end if;
  9. if what='Magneziu' then  
  10. select Magneziu into last_value from (select * from analize where ID_PACIENT=id ORDER BY ID_ANALIZA DESC) where rownum<2;  
  11. ELSIF what='Calciu' then  
  12. select Calciu into last_value from (select * from analize where ID_PACIENT=id ORDER BY ID_ANALIZA DESC) where rownum<2;  
  13.  
  14. ELSIF what='Colesterol' then  
  15. select Colesterol into last_value from (select * from analize where ID_PACIENT=id ORDER BY ID_ANALIZA DESC) where rownum<2;  
  16.  
  17. ELSIF what='Sodiu' then  
  18. select Sodiu into last_value from (select * from analize where ID_PACIENT=id ORDER BY ID_ANALIZA DESC) where rownum<2;  
  19.  
  20. ELSIF what='Trigliceridele' then  
  21. select Trigliceridele into last_value from (select * from analize where ID_PACIENT=id ORDER BY ID_ANALIZA DESC) where rownum<2;  
  22.  
  23. ELSIF what='Glicemia' then  
  24. select Glicemia into last_value from (select * from analize where ID_PACIENT=id ORDER BY ID_ANALIZA DESC) where rownum<2;  
  25.  
  26. ELSIF what='Trombocite' then  
  27. select Trombocite into last_value from (select * from analize where ID_PACIENT=id ORDER BY ID_ANALIZA DESC) where rownum<2;  
  28.  
  29. ELSIF what='Leucocite' then  
  30. select Leucocite into last_value from (select * from analize where ID_PACIENT=id ORDER BY ID_ANALIZA DESC) where rownum<2;  
  31.  
  32. ELSIF what='Hematii' then  
  33. select Hematii into last_value from (select * from analize where ID_PACIENT=id ORDER BY ID_ANALIZA DESC) where rownum<2;  
  34.  
  35.  
  36. END IF;  
  37.  
  38.  return last_value;  
  39. END getValoare;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top