Good afternoon!


I have a SQL that when I do the test of output executes normal, however when I run at runtime monitoring by debug it does not run, it hangs in this SQL, you know what can be happening?



Here is the SQL with dummy data, but the structure is the same ...


NOTE: The query normally runs directly on the SQL Oracle database


SELECT
    PRC.ID,
    PRC.N,
    PRC.A,
    PRC.P,
    'PRODUTO A' AS PRODUTO,
    PFE.V,
    PRC.CON,
    PFE.VAL,
    PRC.OBJ,
    PRC.FAS,
    PRC.AMO,
    PRC.AMOU,
    PRC.ATU,
    PRC.AT,
    PRC.AAL_SA,
    PRC.BTUAL_SDO_P,
    PRC.L_AT,
    NVL(PRC1.ATU - PRC1.AAL_SA,0),
    PV.VALOR,
    PRC.PRODUTO_NOME,
    CASE
        WHEN PRC.STB= 1 THEN
            'FECHADO'
        ELSE
            'ABERTO'
    END AS STB,
    DEFINE_COR_RELATORIO_PROD(PRC.PRC_

PRODUTO_ID,PRC.ID,999,999),
    PRC.PRC_PRODUTO_ID
    FROM PRC_PRODUTO PRC
        LEFT JOIN PRC_PRODUTO PRC1
            ON PRC.PRC_PRODUTO_ID = PRC1.PRC_PRUDUTO_ID
                AND PRC.STB = 1
        LEFT JOIN PRC_PRODUTO_PV PV
            ON PRC.PRC_PRODUTO_ID = PV.PRC_PRODUTO_ID
                AND PV.PRODUTO_VALOR_TIPO IN ('PRODUTO A'
                    ,'PRODUTO B')
                AND PRC.STB = 1
        LEFT JOIN PRC_PRODUTO_ELFV PFE
            ON PRC.PRC_PRODUTO_PRC_ID = PFE.PRC_PRODUTO_PRC_ID
        WHERE PRC.PRC_PRODUTO_ID = 999;

You should enclose the table names in {}

Ravi V wrote:

You should enclose the table names in {}


Good Morning!

Sorry, I removed {} from the tables when editing the query. SQL is ok in Outsystems, however when you run SQL it gets stuck

What do you mean by "stuck"?

Did you received any error message? There is any error being logged?

Cheers.

Eduardo Jauch wrote:

What do you mean by "stuck"?

Did you received any error message? There is any error being logged?

Cheers.

"Stuck" would it not pass that action, the system hangs in the SQL action


Do you have comments in the original query? like using --?

In runtime, the query will be sent in a single line, and those comments will kill your query...

This does not happen when testing.

Maybe this is the problem...

Cheers