how to use JpaOutboundGateway handleRequestMessage() - spring-data-jpa

How can I use JpaOutboundGateway , handleRequestMessage(),
I want to perform a select Query , please help me to write code to execute the select query and get the resultset.

Related

Getting PostgreSQL function output in single call

I have a PostgreSQL function which has a ref cursor as output parameter;
I know i can get output using below set of commands
begin;
select uspfillactions();
fetch All in "<unnamed portal 1>";
rollback;
But just want to know is there any way to get function output using single query?
Any dynamic query solution or anything else?
I don't want to mention Begin and rollback/commit also.

Execute query within query (PostgresAdmin III)

I have a very long cleaning procedure with 1000s of "replaces".
I saved this in a separate file.
All other processes are defined in another query.
I would like to execute the cleaning file from the main query.
Is this possible and how to do that?
Example:
Main query file
create table a as
select * from b;
--a lot of other stuff--
execute cleaning query here!! -- I want to execute the cleaning query within my main query
-- cleaning query looks as follows (don't want to paste this into main query):
create table a_ as
select *, replace(replace(replace(...(a1
, 'WORD1', '')
, 'WORD2', '')
, 'WORD3', '')
... from a ;
-- end of cleaning query
--again a lot of stuff --
I suggest you using a trigger. PostgreSqlDocumentation: trigger
A trigger allows you to call functions (query); you can also declare it for each row so you can write a query which refers to only one generic row, than the trigger will apply it to every row of the table (you can also ask for a condition to be fulfilled)

Error using regular expressions in DB2 - wrong syntax?

i tried to run this query in DB2 ( which includes regex ). I am getting the following error. Can someone help?
Here is the query:
SELECT COUNT(*) FROM TABLE WHERE REGEXP_LIKE(TRIM(FIELD), '[^[:digit:]]')
Support for BOOLEAN data type is new in Db2 11.1.1.1 (i.e. the first Mod Pack + Fix pack for Db2 11.1). If you are only on Db2 11.1.0.0, then you will need to explicitly test the result of your regex function.
SELECT COUNT(*) FROM TABLE
WHERE REGEXP_LIKE(TRIM(FIELD), '[^[:digit:]]') = 1;

How to get data from specific column in firebird using rdb$field_name

how to get data from a specific column in fire bird? something like.
select from rdb$relation_fields
where rdb$relation_name = 'table' and rdb$field_name = 'code'
Your question doesn't quite make sense to me - if you already know the table and field name (as you do in your example) then why not select directly from the table? Anyway, you can create SQL statement dynamically in PSQL as string and then execute it using EXECUTE STATEMENT. The EXECUTE BLOCK might also be of intrest, depends where and what exactly youre tring to achieve.
EDIT after reading the comment
So just build the SELECT statement at the client side, selecting the field currently selected in combobox. You don't mention the language you use but generaaly it something like
query.SQL := 'SELECT '+ comboField.Text +' FROM '+curTableName;
query.Open();
// read the resultset

TSQL How to exec a stored procedure inside select query?

is it possible to execute a storep procedure inside select query ?
select e.Name, dbo.get_sth e.Id
from emp e
I get the error
Incorrect syntax near 'e.Id'
No. But you can execute a function inside a select statement. So recreate your Stored Procedure as a function and this should work.
It will be called for every row so be careful of performance if returning many rows.