cancel
Showing results for 
Search instead for 
Did you mean: 

How to declare a variable in sql script

Former Member
0 Kudos

Hi

How to declare a variable same as the table's column data type ..

Like I have a table employee and salary as a column

I want to create a variable salary_column salary as salary .

I have no idea what is the data type of salary ...

please suggest ..

Accepted Solutions (0)

Answers (1)

Answers (1)

rindia
Active Contributor
0 Kudos

Hi Surya,

You can easily find the data type for a column.

Go to Catalog - Expand your Schema - Tables - Table name (Employee) - Right click - Open Definition.

Once you know the data type you can declare it in sqlscript.

Please refer the below link to have an example:

Table Variable type definition.

Regards

Raj

Former Member
0 Kudos

Hi Raj ..

thanks for your reply ..I am doing in this way only ..but I want to know any other syntax is there in HANA or not ..

because in ABAP and Oracle has syntax for this

rindia
Active Contributor
0 Kudos

Hi Surya,

Actually what you are trying to do?

If you can detail your requirement, it will be easy for others to help you out.

Regards

Raj

Former Member
0 Kudos

I want to know , any syntax is there or not

lbreddemann
Active Contributor
0 Kudos

Have you considered to look for the syntax where it usually is defined? The documentation.

It's built right into SAP HANA Studio and also available online.

Just check the SQLScript documentation and you will find the syntax definition for how to define and use variables, structure programs and a lot more.