L language-SAP Hana Study Notes series (2)

Source: Internet
Author: User
    • L stored procedure
    • Use L to customize SQL Functions

In SAP Hana, you can use SQL script to create a stored procedure.Programming LanguageTo implement specific applicationsProgramComplex computing stored procedures. L The stored procedure is basically the same as that of SQL Script Creation. data types or table types can be used as input and output parameters. That is to say, l can be used directly by other SQL script stored procedures or database clients, just like other stored procedures.

L is based on C/C ++ and can look at the subset of C ++; it is a static type; L is to be compiled, and l functions are not executed on the VM, it is executed on Standard C/C ++ functions.

Instance introduction l stored procedure
Create ProcedureSystem.Proc(...) Language llang reads SQL dataAs BeginImport "content: COM. sap. My. lib" mylib; export void main (...) {... mylib: F1 (...);...}End

First, content: COM. sap. My. Lib is imported, and mylib is the namespace of L. The prefix content indicates that the Library is in the repository of SAP Hana. In the main function, we call the F1 function in the library. Entire LCodeIt looks very similar to C ++.

Use L to customize SQL Functions
Create FunctionSqr (xDouble)Returns"Y"DoubleLanguage llangAs BeginExport void main (Double"X" X,Double"Y"&Y) {Y=X*X ;}End;

You can use this statement to call this function.

SelectSqr (doublevaluecol)FromTable1

For the time being, we will introduce this point first. If you are interested, you can communicate offline.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.