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.
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.
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.
@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.
@Sai Krishna said: Hello Jeff,
Please find the error message below:
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".
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'.
@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'.
@Sai Krishna said: Hi Jeff,
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; _
There are examples here: https://wiki.postgresql.org/wiki/MergeTestExamples