Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to call a function in plsql function

Tags:

sql

oracle

plsql

I have a plsql function and I want to call an other function from my function. how can I do this?

FUNCTION ortak_icra_job(prm_dosya_id             dosya.id%TYPE,
                     prm_aciklama             icra_hareket.aciklama%TYPE,
                     prm_kullanici_id         kullanici.id%TYPE,
                     prm_ask_ind_kayit_sayisi OUT NUMBER,
                     prm_hata_metni           OUT VARCHAR2,
                     prm_hata_kodu            OUT hata_mesaji.id%TYPE) 
BEGIN

askidan_indir(prm_dosya_id ,
               prm_aciklama ,
               prm_kullanici_id ,
               prm_ask_ind_kayit_sayisi ,
               prm_hata_metni ,
               prm_hata_kodu )

END;

is this correct way to do this ?

like image 431
EmreAltun Avatar asked Oct 15 '12 07:10

EmreAltun


2 Answers

Here is an example how to run function. There are two ways to do that.

  1. Try to add result value:

    result := askidan_indir(prm_dosya_id,
               prm_aciklama,
               prm_kullanici_id,
               prm_ask_ind_kayit_sayisi,
               prm_hata_metni,
               prm_hata_kodu )
    
  2. You can also use your function in select statement:

    select askidan_indir(prm_dosya_id,
                     prm_aciklama,
                     prm_kullanici_id,
                     prm_ask_ind_kayit_sayisi,
                     prm_hata_metni,
                     prm_hata_kodu) 
    into result  
    from dual;
    
like image 123
Robert Avatar answered Nov 16 '22 00:11

Robert


Functions must return a value, else you should have an assignment target to the function.

FUNCTION ortak_icra_job(prm_dosya_id             dosya.id%TYPE,
                     prm_aciklama             icra_hareket.aciklama%TYPE,
                     prm_kullanici_id         kullanici.id%TYPE,
                     prm_ask_ind_kayit_sayisi OUT NUMBER,
                     prm_hata_metni           OUT VARCHAR2,
                     prm_hata_kodu            OUT hata_mesaji.id%TYPE) 
  RETURNS VARCHAR2 IS
v_result varchar2(200);
BEGIN

v_result := askidan_indir(prm_dosya_id ,
               prm_aciklama ,
               prm_kullanici_id ,
               prm_ask_ind_kayit_sayisi ,
               prm_hata_metni ,
               prm_hata_kodu );
RETURN v_result;
END;
like image 25
Sathyajith Bhat Avatar answered Nov 16 '22 00:11

Sathyajith Bhat