Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem with EXISTS Predicate

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

Tags:
Former Member
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question