Linker IT Software
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
Use bind variable in PL/SQL (Read 2854 times)
Gerrit-Jan Linker
YaBB Administrator

Posts: 75
Use bind variable in PL/SQL
21.05.15 at 13:52:30

Use bind variable in PL/SQL
The following example shows how bind variables can be used to bring information back from a PL/SQL block. Actually the code was recorded in Excel, which is the preferred method to develop SQL*XL code.
The setText line defines the SQL.  
In subsequent lines the parameter aaa is defined as an IN/OUT parameter. This is important.
After running the SQL against an Oracle database you can read out the parameter value.
Sub Macro4()
    SQLXL.Sql.setText "begin :aaa := 'hello'; end;"
    With SQLXL.Sql.Statements(1).BindVariables("aaa")
       .DataType = litTypeOther
       .Mode = litParamInOut
       .Value = "123"
    End With
    MsgBox SQLXL.Sql.Statements(1).BindVariables("aaa").Value
End Sub
Back to top

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1