4 Replies Latest reply: Jul 18, 2014 2:05 AM by Gaurav Pandya RSS

    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

      Col1

      Col2

      Col3

       

      XML Template

      <insert>

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

      </insert>

      -------

      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

      <insert>

      DECLARE

      Count Integer;

      BEGIN

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

      if count = 0 then

      Insert into TableA values(Col1, Col2, Col3)

      end if

      </insert>

       

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

       

      Thanks

      Gaurav