Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

SQL parse error, problem with Exist()

Hi, in script i load two tables,

ACTIVITY_DEFS:

LOAD DESCRIPTIVENAME as DESCRIPTIVENAME_ACT_DEFS,

    ID as ID_ACT_DEFS,

    INSTRUCTIVENAME as INSTRUCTIVENAME_ACT_DEFS;

SQL SELECT DESCRIPTIVENAME,

    ID,

    INSTRUCTIVENAME

FROM "VT_DM_DATABASE"."BI_TWFLACTIVITYDEFS";

ACTIVITY_INSTANCES:

LOAD ACTIVITY_ID as ACTIVITY_ID_ACT_INST,

    ID as ID_ACT_INST,

    "IPROCESS_ID" as ID_PROCESS_INSTANCES,

    "LASTASSIGNEDBY_ID" as LASTASSIGNEDBY_ID_ACT_INST,

    "LASTWORKER_ID" as LASTWORKER_ID_ACT_INST,

    STARTDATE as NA_STAN_DATA_ACT_INST,

SQL SELECT ACTIVITY_ID,

    ID,

    "IPROCESS_ID",

    "LASTASSIGNEDBY_ID",

    "LASTWORKER_ID",

    STARTDATE

FROM "VT_DM_DATABASE"."BI_TWFLACTIVITYINSTANCES" WHERE EXISTS (ID_ACT_DEFS, ACTIVITY_ID);

And after adding this WHERE EXISTS ... statement i got the following error :

SQL##f - SqlState: 37000, ErrorCode: 4294963590, ErrorMsg: [Teradata][ODBC Teradata Driver][Teradata Database] Syntax error: parse error.

SQL SELECT ACTIVITY_ID,

    ID,

    "IPROCESS_ID",

    "LASTASSIGNEDBY_ID",

    "LASTWORKER_ID",

    STARTDATE

FROM "VT_DM_DATABASE"."BI_TWFLACTIVITYINSTANCES" WHERE EXISTS (ID_ACTIVITY_DEFS, ACTIVITY_ID)

I tried almost everything to solve this, what am i missing ?

Tags (4)
1 Solution

Accepted Solutions

Re: SQL parse error, problem with Exist()

EXISTS() is a QlikView function, not a SQL function. You cannot use QlikView functions in SQL statements.

Add the WHERE EXISTS() clause to the PReceding LOAD instead, and you're good.

Best,

Peter

6 Replies

Re: SQL parse error, problem with Exist()

EXISTS() is a QlikView function, not a SQL function. You cannot use QlikView functions in SQL statements.

Add the WHERE EXISTS() clause to the PReceding LOAD instead, and you're good.

Best,

Peter

mato32188
Contributor III

Re: SQL parse error, problem with Exist()

Hi Jakub,

in where exists clause use also SELECT ... FROM syntax.

BR

M

anbu1984
Honored Contributor III

Re: SQL parse error, problem with Exist()

SQL SELECT ACTIVITY_ID,

    ID,

    "IPROCESS_ID",

    "LASTASSIGNEDBY_ID",

    "LASTWORKER_ID",

    STARTDATE

FROM "VT_DM_DATABASE"."BI_TWFLACTIVITYINSTANCES" Where ID_ACT_DEFS Not In (Select ID from "VT_DM_DATABASE"."BI_TWFLACTIVITYDEFS");

Or

ACTIVITY_INSTANCES:

LOAD ACTIVITY_ID as ACTIVITY_ID_ACT_INST,

    ID as ID_ACT_INST,

    "IPROCESS_ID" as ID_PROCESS_INSTANCES,

    "LASTASSIGNEDBY_ID" as LASTASSIGNEDBY_ID_ACT_INST,

    "LASTWORKER_ID" as LASTWORKER_ID_ACT_INST,

    STARTDATE as NA_STAN_DATA_ACT_INST WHERE EXISTS (ID_ACT_DEFS, ACTIVITY_ID);

SQL SELECT ACTIVITY_ID,

    ID,

    "IPROCESS_ID",

    "LASTASSIGNEDBY_ID",

    "LASTWORKER_ID",

    STARTDATE

FROM "VT_DM_DATABASE"."BI_TWFLACTIVITYINSTANCES" ;

Not applicable

Re: SQL parse error, problem with Exist()

I think you mean "ID_ACT_DEFS In" and not "ID_ACT_DEFS Not In"

rajeshvaswani77
Valued Contributor III

Re: SQL parse error, problem with Exist()

Hi,

Exists will need a sub query.

You seem to be mixing the QlikView exists here.

thanks,

Rajesh Vaswani

anbu1984
Honored Contributor III

Re: SQL parse error, problem with Exist()

Yes you are right

Community Browser