There is no output from SQL General

Hello, guys.
I am trying to run PL/SQL from Pipeline Pilot.
When I run it in SQL Developer, SQL Plus, etc. there is output, but not from the component.

No errors occur in the component, but no data records flow either.
What should I do?

This is my Protocol.
It is a minimal state that can reproduce the phenomenon(DB schema creation, etc. not included.).

​​​​​​

This is my dummy data.

-- create DB obj...<br />CREATE TABLE DATA_DEF (<br />    DATA_ID raw (16) DEFAULT SYS_GUID() NOT NULL,<br />    DATA_NAME VARCHAR2 (50) NOT NULL,<br />    PRIMARY KEY (DATA_ID)<br />);<br /><br />-- insert data...<br />INSERT INTO DATA_DEF ( DATA_NAME ) VALUES ( 'Which' ) ;<br />INSERT INTO DATA_DEF ( DATA_NAME ) VALUES ( 'country' ) ;<br />INSERT INTO DATA_DEF ( DATA_NAME ) VALUES ( 'would you' ) ;<br />INSERT INTO DATA_DEF ( DATA_NAME ) VALUES ( 'like' ) ;<br />INSERT INTO DATA_DEF ( DATA_NAME ) VALUES ( 'to go' ) ;

This is my PL/SQL.
I would run this by the component.

DECLARE<br />    v_id VARCHAR2(50);<br />    v_sql VARCHAR2(4000);<br />BEGIN<br />    -- get id from Protocol<br />    v_id := 'F2A549E00118448083EF9E3FC3F30A19';<br /><br />    -- generate SQL<br />    v_sql := 'SELECT DATA_ID, DATA_NAME FROM DATA_DEF WHERE DATA_ID = :1';<br /><br />    -- check var<br />    DBMS_OUTPUT.PUT_LINE(v_sql);<br />    DBMS_OUTPUT.PUT_LINE(v_id);<br />    -- execute SQL<br /><span class="marker">    -- I want to get this results.<br />    EXECUTE IMMEDIATE v_sql USING v_id;</span><br />END;


Answers 7
AC
AC 2024-01-26 Best Answer

Hi @TK. I assume maybe this is because you've simplified the example, but I want to confirm just in case. The easiest way to execute the SQL statement you show above is to set the "SQL Statement" in a SQL Select component to be:

SELECT DATA_ID, DATA_NAME <br />FROM DMY_SCHEMA.DATA_DEF <br />WHERE DMY_SCHEMA.DATA_DEF.DATA_ID = '$(id_from_protocol)'

If you want to execute a procedure, it would probably be better to create a stored procedure in Oracle first and then call it by setting the SQL Statement to {call myPackage.myProcedure(in and out arguments) } in a SQL General component. There is more information about how to call stored procedures in the Database Integration Guide help document for which a link is provided in the Help text of the SQL General component.

AC
AC 2024-01-26

Hi @TK. It's hard to tell without having more information about your configuration, but one thing that you can try is to open the SQL Statement parameter on the SQL General component and enter a valid SQL statement on the Edit SQL tab, then click the Execute SQL button on the bottom left. Do you see any results or do you get an error? Another question: do you see the same behaviour with the SQL Select component?

TK
TK 2024-01-26

Hi @AC .
Thanks for the response.
Uploaded reproduction protocol.


>Do you see any results or do you get an error? Another question: do you see the same behaviour with the SQL Select component?
No errors are displayed.
No results are displayed (indicating that no data records are output from the component).

>Another question: do you see the same behaviour with the SQL Select component?

Yes.

TK
TK 2024-01-26

Thank you for your response.
PL/SQL is used to dynamically change the rows/otherclauses to be selected in the SELECT.

    v_sql := 'SELECT DATA_ID, DATA_NAME FROM DATA_DEF WHERE DATA_ID = :1';

In my case, it seems that I need a function, but it is a bit laborious to create one, considering the cases where the number is surprisingly necessary :-(.
I'm going to create a simple SELECT combined with Pipeline Pilot.

AC
AC 2024-01-26

@TK ​​​​​​​Please note that if your SQL statement needs to be dynamically-generated during the protocol run, you can put that into a Pipeline Pilot global property like this:


@mysqlstatement := 'select * from document'


and then you can set the SQL Statement of the SQL Select component to be:


$(mysqlstatement)


@CB ​​​​​​​do you have anything else to suggest?

CB
CB 2024-01-26

@AC and @TK The select statement that Andrei suggested seems to be a reasonable alternative to that pl/sql block, unless there's a lot of detail that is not reflected.

For what it's worth, if id_from_protocol is not a global, but a property on a data record, the statement can be specified as "select data_id, data_name from data_def where data_id=?" and id_from_protocol can be set as value of the 'SQL Parameter Mapping' parameter.


TK
TK 2024-01-26

@AC ​​​​​​​
Thank you for your generous support.
I have generated the SQL this way.

My Pilot Script looks like this.

// generate col name example.<br />If AAA Then<br />  #col := 'TYPEA_'.Index;<br />Elsif BBB Then<br />  #col := 'TYPEB_'.Index;<br />Else<br />  Error('colname err.');<br />End if;<br /><br />// generate sql statement(Dummy statement).<br />@sql := "SELECT ID,".#col." FROM SCHEMA.TBL_NAME WHERE ID = '".#ID."' ORDER BY DATA_ORDER ASC;";

@sql with the SQL Select component.
To avoid @sql conflicts, @sql was used in DeclareLocal.

Thanke:-)!