cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to create a synonym in a procedure?

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Aditya,

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

Regards,

Anil

0 Kudos

Hi Anil,

  Thanks for the quick response. But as per my understanding we need to create copy of the table into other. But as the table are always physically exists, hence if any changes into the original table will not modify the copied (newly created) table.

Whereas if this could be possible by views/synonym, would be better option, as these are virtual and accessing data from table at the place of it's own existence.

Thanks & Regards,

Pranjal

Former Member
0 Kudos

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