Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Physical table is not allowed in OUT table variable position: OP_SALES_BOOKS

$
0
0

Hi ,

 

I am new to SAP HANA script. I am learning SQL script by seeing the SQL script tutorial in the SAP HANA technical documents folder.

 

I was trying to run the below procedure  but  I am getting the error like Physical table is not allowed in OUT table variable position: OP_SALES_BOOKS. But  I used physical row type table in the call statement to store the result .  But  for this procedure I am getting error .

 

CREATE PROCEDURE addDiscount( IN it_books tt_sales_books, OUT ot_books tt_sales_books)

    LANGUAGE SQLSCRIPT READS SQL DATA AS

BEGIN

  ot_Books = SELECT title, CASE WHEN price > 300 THEN (price - (price / 30))

                                ELSE CASE WHEN price > 200 THEN (price - (price / 20))

                                          ELSE (price - (price / 10))

                                     END

                           END AS price, crcy

             FROM :it_books;

END;

 

CREATE PROCEDURE getSalesBooks( IN minPrice DECIMAL(5, 2), IN currency VARCHAR(3),

                                IN it_books books, OUT ot_sales tt_sales_books)

   LANGUAGE SQLSCRIPT READS SQL DATA WITH RESULT VIEW addDiscount_RET AS

BEGIN

  lt_expensive_books = SELECT title, price, crcy

                       FROM :it_books

                       WHERE price > :minPrice

                       AND crcy = :currency;

 

  CALL addDiscount(:lt_expensive_books, lt_on_sale);

 

  lt_cheap_books = SELECT title, price, crcy

                   FROM :it_books

                   WHERE price <= :minPrice

                   AND crcy = :currency;

 

  ot_sales = CE_UNION_ALL(:lt_on_sale, :lt_cheap_books);

END;

 

CALL getSalesBooks(1.5, '''EUR''', books, op_sales_books);

 

Please help me how to resolve this issue.

 

Thanks & Regards,

Ramana.


Viewing all articles
Browse latest Browse all 6412

Trending Articles