3 Replies Latest reply: Jan 15, 2013 2:35 AM by HakanBiroglu RSS

    SELECT and BIND In AE Program

    Raju Penmetsa
      Hi All , Could any one tell me how exactly %select and %bind works while coming to an AE Program , I read in many forums about these like %select - used to populate the state record %bind is used to get the value from state record ,, what it exactly mean ? %select (name it self bit confusing , as general assumption getting data from DB or State Record) .

      Thanks In Advance
        • 1. Re: SELECT and BIND In AE Program
          HakanBiroglu
          As you may know every Application Engines should have at least one State Record.
          This is used by the application engine as, if I may call it like that, a placeholder for values across the application engine steps.

          The %select is used to select/write data to the state record in SQL/DoSelect steps.
          For example
          %SELECT(MY_STATEREC_AET.MY_FIELD)
          SELECT 'Y' FROM PS_INSTALLATION

          This would set the value 'Y' in the staterecord MY_STATEREC_AET in field MY_FIELD

          In PeopleCode steps you can assign the value directly without %select

          For example:
          MY_STATEREC_AET.MY_FIELD = "Y";

          The %bind is there to retrieve values from the state record and to be used in SQL steps

          For example
          UPDATE RECORD
          SET COLUMN = %BIND(MY_STATEREC_AET.MY_FIELD)

          For more details on this please read PeopleBooks on Application Engines
          http://docs.oracle.com/cd/E28394_01/pt852pbh1/eng/psbooks/tape/book.htm


          Hope this clarifies your question.

          Hakan
          • 2. Re: SELECT and BIND In AE Program
            Raju Penmetsa
            Hi Haken , here my_field has to be there in state record ? we need to put it manually ? What I understood is you need to take all the fields initially in to the state record then need to apply %select (field1,field2........) ,, What happens if the data type does not matches in b/w them ?
            • 3. Re: SELECT and BIND In AE Program
              HakanBiroglu
              I think you haven't fully understood the principle.

              The state record is a container that you can use to values and use this values over steps and actions, you do not have to use it.
              It is useful of storing the return values of SELECT statement and reuse these value in other steps and actions of your AE.

              >
              What happens if the data type does not matches in b/w them ?
              >

              You are the one that is writing code to add values to the state record, so you should know if the data types match.

              Hakan