Skip to Content
0
Former Member
Apr 09, 2015 at 07:21 PM

Problem with EXISTS Predicate

318 Views

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