How to include sql function in an sql query in Dataset using Opentext Birt tool

Hello,

I would like to add an sql function in the SQL query using Case condition in the Dataset using BIRT tool. Could anyone please help me how to write a query for this. Or if there any other option like mapping in the tool. Thanks in advance.

Thanks & Regards,
Sai

Comments

  • The query syntax depends on the database. Birt doesn't have its own query language. It simply passes the query to the database through the database driver and the result is returned. Look at what the database expects for syntax. You can find the syntax by searching the web, looking at the database user guide, or asking on a forum for the database you are using.

    Jeff F.
    Customer Support Engineer I
    OpenText
  • Hello Jeff,

    Good day!
    I have to write an if condition like :
    if ID matches - then do update to the remaining columns of that ID.
    else - then do insert that values into the table.
    But I have to write this condition in PGSQL. Here I am trying to use MERGE in the function. But after that I am getting an error. Could you please help me how to merge in pgsql.

    Thanks in advance.

    Thanks & Regards,
    Sai
  • @Sai Krishna said:
    Hello Jeff,

    Good day!
    I have to write an if condition like :
    if ID matches - then do update to the remaining columns of that ID.
    else - then do insert that values into the table.
    But I have to write this condition in PGSQL. Here I am trying to use MERGE in the function. But after that I am getting an error. Could you please help me how to merge in pgsql.

    Thanks in advance.

    Please find the error message below:

    Thanks & Regards,
    Sai
  • edited September 12

    Hi Sai,

    I wish I could help, but this question is outside of the forum scope. I noticed that the error message has an extra "t" at the end of "insert".

    Jeff F.
    Customer Support Engineer I
    OpenText
  • Hi Jeff,

    It was the user-defined table name "insertt" created by me. I have given two t's to make it different with the keyword 'insert'.
    :neutral:

    Thanks & Regards,
    Sai
  • @Sai Krishna said:
    Hi Jeff,

    It was the user-defined table name "insertt" created by me. I have given two t's to make it different with the keyword 'insert'.
    :neutral:

    And Could you also please tell me how to use MERGE in postgre SQL. I am getting the above error while I am running the below code in the postgre SQL function.( I am using pgAdmin III). Please let me know if I have done any mistake in the code while creating the function.

    Code:-

    _BEGIN

    MERGE INTO insertt as target  
    USING (values(uusername, ttime)) AS source
    ON (target.user_name = source.uusername)  
    
    THEN MATCHED and target.user_name source.uusername THEN
    UPDATE SET target.scrolltime = source.ttime 
    
    WHEN NOT MATCHED BY target THEN  
        INSERT (user_name, scrolltime) VALUES (source.uusername, source.ttime);
    

    END; _

    Thanks in advance.

    Thanks & Regards,
    Sai
  • Jeff F.
    Customer Support Engineer I
    OpenText
Sign In or Register to comment.