Skip to Content
avatar image
Former Member

Is it possible to create a synonym in a procedure?

Hi all,

I have a scenario for UOM conversion. I have imported all the tables required. But for my requirements, I had to again create these tables using '.hdbti'.

When I create these using .hdbti, as per HANA convention, the table is created along with a namespace(I have attached a screenshot - Capture1).

For the UOM conversions to happen, HANA expects these tables to be present without the namespace in the schema (Like T006 and not sap..... :: T006). Hence, i need synonyms for these tables, and I need these synonyms in any system where the related DU is going to be imported.

Is these any possible means of achieving this?

I thought of creating a procedure which on execution will create the required synonyms, but I get the following error in the procedure?

Syntax error in procedure object: feature not supported; ddl statement 'CREATE SYNONYM "SAP_AAA"."T006" FOR "SAP_AAA"."sap.rsm.xs.db.erptable::T006"' is not supported in procedure/function: line 12 col 2 (at pos 202)

Thank you in advance for your responses.

Capture.PNG (11.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Oct 19, 2015 at 06:50 AM

    Hi Aditya,

    Please try using Dynamic SQL and EXECUTE_IMMEDIATE which would serve the purpose.

    Regards,

    Anil

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      You don't have to copy the tables, my suggestion was to use dynamic SQL and execute immediate statement to create synonyms inside the procedure which you were trying to do and was encountering an error.

      Regards

      Anil