Good afternoon, thank you, I will contact technical support for clarification
Original Message:
Sent: Thu February 18, 2021 08:26 AM
From: NIGEL CAMPBELL
Subject: Stored procedure query subjects Postgresql
Due to the way the PostgreSQL implemented things, you need to follow the approach as shown in https://www.ibm.com/support/pages/node/1076721
While PostgreSQL introduced CREATE PROCEDURE syntax, if you are using PostgreSQL ODBC (i.e. CQM), it will describe them as functions.
If you are using Dynamic Query, PostgreSQL JDBC will return metadata for the same objects when their implementation for DatabaseMetadata.getProcedures or getFunctions are called. In other words, you may observe the same object appearing twice.
If you are using CQM/PostgreSQL ODBC, contact support, about how to force functions to be treated as procedures in FM.
Historically, Informix created the opposite challenge, it claimed all procedures were functions.
While FM UX has a gesture to turn a function into a procedure, there is no equivalent in FM for procedure to function.
Most vendors do not have these idioms.
------------------------------
NIGEL CAMPBELL
Original Message:
Sent: Tue February 16, 2021 12:22 AM
From: Илья Буланов
Subject: Stored procedure query subjects Postgresql
Good afternoon, perhaps someone has encountered a problem.
I want to use a function from postgresql in cognos that returns the cursor.
CREATE TABLE test AS
SELECT
('{a,b,c,d,e,f}'::text[])[1 + FLOOR(random() * 6)] AS type_1,
('{m,n,o,p,q,r}'::text[])[1 + FLOOR(random() * 6)] AS type_2,
random() * 1000 AS some_float
FROM generate_series(1,20000);
CREATE OR REPLACE FUNCTION test_cur_cognos() RETURNS setof test AS $$
DECLARE
ref refcursor; -- Declare a cursor variable
BEGIN
SELECT type_1, type_2, some_float FROM test; -- Open a cursor
-- Return the cursor to the caller
END;
$$ LANGUAGE plpgsql;
Cognos refuses to accept a function as a data source. Perhaps someone has a solution how to implement this through the procedure?
------------------------------
Илья Буланов
------------------------------
#CognosAnalyticswithWatson