This discussion is archived
5 Replies Latest reply: Dec 3, 2013 4:00 AM by Sangu Patil RSS

How to pass date patrameter form oaf page to pl/sql procedure

Sangu Patil Newbie
Currently Being Moderated

Hi ,

 

  I have developed the update page, in that i am using the api for update so now i have to pass the schedule ship date to yhe procedure as parameter.

  Plz any one will help how to pass the date as parameter.

  Please.

 

Regards,

Sangu

  • 1. Re: How to pass date patrameter form oaf page to pl/sql procedure
    Siva Prasad Nidimamidi Newbie
    Currently Being Moderated

    Hello,

     

    You must have create a field with data type as date. So i dont think there would be any problem.

     

    But are you facing any problem while passing. If so please give me error message.

     

    Siva

  • 2. Re: How to pass date patrameter form oaf page to pl/sql procedure
    Sangu Patil Newbie
    Currently Being Moderated

    Hi,

    I have created the field with datatype as date and passing the parameter i am getting null pointer exception.

     

     

    I have created the method in AM as below.

    public void Update(String updateBacklog,String updateSSD)
        {
        OADBTransaction oadbtransaction=(OADBTransaction)getTransaction();
        OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getTransaction();
           //String retValues;
        StringBuffer str = new StringBuffer();

     

        str.append( " BEGIN ");
        str.append( " xxsy_om_so_ssd_update_pkg.main( ");
        str.append( "   p_line_id       => :1, ");
        str.append( "   p_promise_date  => :2, ");
        str.append( "); ");
        str.append( " END; ");
        OracleCallableStatement oraclecallablestatement =
         (OracleCallableStatement)oadbtransaction.createCallableStatement(str.toString(), 1);
        try{
         oraclecallablestatement.setInt(1,  Integer.parseInt(updateBacklog));
         oraclecallablestatement.setDate(2,  Date.valueOf(updateSSD) );
         //oraclecallablestatement.setString(3,"Record Updated successfully");
         oraclecallablestatement.execute();

     

           // retValues = oraclecallablestatement.getString(3);

     

        }
         catch(Exception e)
            {
         throw OAException.wrapperException(e);
             }
       

    }

     

    And my code in controller is

     

      if(pageContext.getParameter("Update")!=null)
      {
          //OAApplicationModule am = pageContext.getApplicationModule(webBean);
            
          Serializable[] parameters1 = { pageContext.getParameter("updateBacklog").toString(),
                pageContext.getParameter("updateSSD"),
               };
          
          am.invokeMethod("Save");
             
           String retVals1 = (String)am.invokeMethod("Update", parameters1);

    }

     

  • 3. Re: How to pass date patrameter form oaf page to pl/sql procedure
    DilipG Journeyer
    Currently Being Moderated

    Hi,

     

    Convert your Date Promise Date Field using getOANLSServices().stringToDate().


    //Below is the sample code.

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

    public void Update(String updateBacklog,String updateSSD)

            {

           java.sql.Date promise_date; //declare variable

           OADBTransaction oadbtransaction=(OADBTransaction)getTransaction();

           OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getTransaction();

           //String retValues;

            StringBuffer str = new StringBuffer();

            str.append( " BEGIN ");

            str.append( " xxsy_om_so_ssd_update_pkg.main( ");

            str.append( "       p_line_id           => :1, ");

            str.append( "       p_promise_date      => :2, ");

            str.append( "    ); ");

            str.append( " END; ");

            OracleCallableStatement oraclecallablestatement =

            (OracleCallableStatement)oadbtransaction.createCallableStatement(str.toString(), 1);

             try

                 {

                 if(updateSSD!=null)

                   {

                      java.sql.Date pDate= oadbtransaction.getOANLSServices().stringToDate(updateSSD);

                     promise_date = pDate;

                  }

         

             oraclecallablestatement.setInt(1,  Integer.parseInt(updateBacklog));

             oraclecallablestatement.setDate(2,  promise_date);

             //oraclecallablestatement.setString(3,"Record Updated successfully");

              oraclecallablestatement.execute();

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

     

    Check below link also

    How to call pl/sql function from oaf

    https://forums.oracle.com/message/11214384#11214384\

     

    Thanks,

    DIlip

  • 4. Re: How to pass date patrameter form oaf page to pl/sql procedure
    Sangu Patil Newbie
    Currently Being Moderated

    hi,

     

    my page scenario is like as follows

     

    I Have created one search page, After click on go it give the all the search results in that region i have created one update button after clicking that

    it will redirect to update page with respective data.

    In that page after modification, if i click on update button it should update it should call the method i have created

    Now it is giving error that

     

    No method with signature - No method with signature - Update(class java.lang.String, class java.lang.String)

     

    I have created this method in search page AM

    I Attached same AM for both the pages.

    Please any one will help me.

     

    Regards,

    Sangu.

  • 5. Re: How to pass date patrameter form oaf page to pl/sql procedure
    Sangu Patil Newbie
    Currently Being Moderated

    Hi Dilip,

     

    Please will u send the code in the controller please.

    I am getting the error like.

    No method with signature - No method with signature - Update(class java.lang.String, class java.lang.String)

    Please.

     

    Regards,

    Sangu

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points