4 Replies Latest reply on Jul 18, 2014 7:05 AM by Gaurav Pandya

    OBIEE 11g Write Back feature - Can we write (Declare - begin - end) block in XML Template?

    Gaurav Pandya

      Hello Friends,


      I have a requirement like this -

      I need to store User Inputs from Dashboard to Database. For that I am implementing Write Back Feature.

      While Inserting User Input Record into the Database, I need to check if the PK already exists in table or not. How can i place such condition in XML template?

      Please share your thoughts.


      More elaboration.

      Table A





      XML Template


      Insert into TableA values(@c1, @c2, @c3)



      Now, Instead of directly inserting the record into the DB, I want to check if the PK Column already exists in table or not. In short I want to implement something like below. But I am not sure if it is possible or not in XML.


      XML Template



      Count Integer;


      select count(*) into count from TableA where Col1=@c1;

      if count = 0 then

      Insert into TableA values(Col1, Col2, Col3)

      end if



      If anybody has ever come across such situation and has solution to this, please advice.