cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with EXISTS Predicate

Former Member
0 Kudos

Hallo,

I have a problem with SAP HANA SQL EXISTS Predicate. Can somebody help me?

The definition from “SAP HANA SQL and System Views Reference” is:

2.4.4 Exists Predicate

Syntax

    <exists_predicate> ::= [NOT] EXISTS ( <subquery> )

Description

    Returns true if the <subquery> returns a result set that is not empty and returns false if the <subquery> returns an empty result set.

----------------------------------

-- My test procedure

----------------------------------

CREATE PROCEDURE SP_TEST

AS

BEGIN

     IF EXISTS (SELECT BUKRS FROM T001)

     THEN

          SELECT 'THEN …' FROM DUMMY;

     ELSE

          SELECT 'ELSE …' FROM DUMMY;

     END IF;

END;

---------------------------

But I get an error message and the procedure cannot be compiled.

SAP DBTech JDBC: [7] (at 39): feature not supported: Subquery is not allowed

Can somebody help me? Where is my mistake?

Best regards,

Y. Hu

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

The EXISTS predicate as you want to use it can part of a SQL statement but cannot be used as a function within SQLScript.

- Lars

Former Member
0 Kudos

Thank you very much!

Y.Hu

Answers (2)

Answers (2)

former_member393314
Discoverer
0 Kudos

This message was moderated.

Former Member
0 Kudos