how can run PL/SQL from oracle FORMS trigger or procedure/funcktion.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghssal
    New Member
    • Oct 2008
    • 10

    how can run PL/SQL from oracle FORMS trigger or procedure/funcktion.

    HI
    how can run PL/SQL application as:

    create or replace
    function getChecksiffra (in_string varchar2) return number is

    xSvar number := 0;
    xNR number := 0;
    xSumma number := 0;
    xString varchar2(100) := null;
    BEGIN
    if in_string IS NOT NULL then xString:=replac e(in_string,'-'); end if;
    if substr(xString, 12,1) IS NOT NULL
    and substr(xString, 10,1) <= '9'
    and substr(xString, 11,1) <= '9'
    and substr(xString, 9,1) <= '9'
    then
    xNR := to_number(subst r(xString,3,1)* 2);
    if xNR>9 then xNR:=xNR-9; end if;
    xSumma := xSumma + xNR;
    xNR := to_number(subst r(xString,5,1)* 2);
    if xNR>9 then xNR:=xNR-9; end if;
    xSumma := xSumma + xNR;
    xNR := to_number(subst r(xString,7,1)* 2);
    if xNR>9 then xNR:=xNR-9; end if;
    xSumma := xSumma + xNR;
    xNR := to_number(subst r(xString,9,1)* 2);
    if xNR>9 then xNR:=xNR-9; end if;
    xSumma := xSumma + xNR;
    xNR := to_number(subst r(xString,11,1) * 2);
    if xNR>9 then xNR:=xNR-9; end if;
    xSumma := xSumma + xNR;
    xNR := to_number(subst r(xString,4,1)) ;
    xSumma := xSumma + xNR;
    xNR := to_number(subst r(xString,6,1)) ;
    xSumma := xSumma + xNR;
    xNR := to_number(subst r(xString,8,1)) ;
    xSumma := xSumma + xNR;
    xNR := to_number(subst r(xString,10,1) );
    xSumma := xSumma + xNR;
    if xSumma between 61 and 70 then xSvar:=70-xSumma; end if;
    if xSumma between 51 and 60 then xSvar:=60-xSumma; end if;
    if xSumma between 41 and 50 then xSvar:=50-xSumma; end if;
    if xSumma between 31 and 40 then xSvar:=40-xSumma; end if;
    if xSumma between 21 and 30 then xSvar:=30-xSumma; end if;
    if xSumma between 11 and 20 then xSvar:=20-xSumma; end if;
    if xSumma between 0 and 10 then xSvar:=10-xSumma; end if;
    end if;
    return( xSvar );
    /*EXCEPTION when others then return( null );*/
    end;
    /

    From oracle FORMS trigger or procedure/funcktion.
    i check if the numeral which i insert to field is correct.

    Thanks
  • Pilgrim333
    New Member
    • Oct 2008
    • 127

    #2
    Hi,

    What is your problem? You want to call this function from a form, or the function is giving you a wrong result? If it is the latter, then please describe what the function should do.

    If it is the first, then you have 2 options, either put the code in the form, or put the function in a package, make a role for the form and give the role execute rights on the package, and then you can call the function from your form.

    Pilgrim.

    Comment

    • amitpatel66
      Recognized Expert Top Contributor
      • Mar 2007
      • 2358

      #3
      you can always create a procedure or a function in forms builder 6i and then execute them

      Comment

      • ghssal
        New Member
        • Oct 2008
        • 10

        #4
        HI!

        I create a function in forms under program units, but the function is giving me no result!

        The funcktion have to check if the insert numeral to field is correct.

        shall i write any thing in items triggers?

        Comment

        • ghssal
          New Member
          • Oct 2008
          • 10

          #5
          Originally posted by Pilgrim333
          Hi,

          What is your problem? You want to call this function from a form, or the function is giving you a wrong result? If it is the latter, then please describe what the function should do.

          If it is the first, then you have 2 options, either put the code in the form, or put the function in a package, make a role for the form and give the role execute rights on the package, and then you can call the function from your form.

          Pilgrim.
          I create a function in forms under program units, but the function is giving me no result!

          The funcktion have to check if the insert numeral to field is correct.

          shall i write any thing in items triggers?

          Comment

          • Pilgrim333
            New Member
            • Oct 2008
            • 127

            #6
            Hi,

            Where/when do you do the call to the function?

            Pilgim.

            Comment

            • amitpatel66
              Recognized Expert Top Contributor
              • Mar 2007
              • 2358

              #7
              Originally posted by ghssal
              I create a function in forms under program units, but the function is giving me no result!

              The funcktion have to check if the insert numeral to field is correct.

              shall i write any thing in items triggers?
              Hmm ok so from where are you calling this function?


              1. Make sure your function is perfectly compiled in forms builder 6.0 without any errors.
              2. Try calling that function just for testing and print few dummy data on screen to check the flow
              3. Then fit in this function from where you need to actually call and trigger that event (Say button click etc) to check if the function executes correctly


              post back in caseof any issues

              Comment

              Working...