cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Difference between HANA SQL & HANA SQL SCRIPT

Former Member
0 Likes
3,049

Can any one clarify the difference between SQL and SQL Script in Hana? With example?

Does SQL script will be execute without SQL Statements or CE functions is possible?

Thanks in Advance.

Naga Chaitanya

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi Naga Chaitanya,

In sql console  we are using sql statements  and SQL script like cursors, for loops, variables, calculations and so on.

See in img1.

Sql script is used in calculation view scripted …In this sql statements(a) or CE function  (b) Are used.

  1. a.  BEGIN

      tab_var = select col1 from <schema>.<table>;

    END;

  1. b. BEGIN

      tab_var = CE_COLUMN_TABLE ("<schema>.<table>",["Col1"]);

    END;

See in img 2.(sql statements).

See the link http://blog.dbi-services.com/sap-hana-sql-scripting-optimization-the-ce-functions/ .(ce functions)


SQL script without CE functions is still SQL script. Similarly  SQL script without SQL or CE functions is still SQL script. Remember you could have more than just SQL statements or CE functions within a SQL script like cursors, for loops, variables, calculations (e.g. a = b+ c) so on and so on .

An example:

create procedure <schema>.procedurename(

          in a integer,

          in b integer,

          out c integer)

language sqlscript as

begin

c := a + b;

end;

                                                                           

The above procedure is also a SQLscript and it doesn't have a single SQL or CE function.


Regards,

Khaga.

Answers (3)

Answers (3)

Former Member
0 Likes

Hi Chaitanya,

You can refer following thread for more clarifications:

Clarification on SQL vs. SQLScript vs. CE Funct... | SCN

I hope you might get a clear idea from the above thread.

Thanks,

Pragati

Former Member
0 Likes

SQLscript is a programming  script language , it can contains SQL Statements, or variable definition. But CE function can be only used in SQLScript.

pfefferf
Active Contributor
0 Likes

Hello Naga,

I would recommend to have a look to the references guides for SAP HANA SQL and SQL Script. In both documents you will find the basics, extended things and many examples. Especially in the SQL Script document there is a chapter which describes what it is.

Best Regards,

Florian