Jump to content

Recommended Posts

Posted (edited)

Greetings,

I try run a script, with commands oracle, the first command run, no problem, the second, no run.

I miss any parameter?

Best regards.

#include <GUIConstants.au3>


Global $user_pass = InputBox("Pergunta", "senha", "", "*")
Global $user_name = @UserName
Global $host = "HostOracle"

$ADO = ObjCreate("ADODB.Connection")
$ADO.Open("Provider='OraOLEDB.Oracle';Data Source='" & $host & "';User Id='" & $user_name & "';Password='" & $user_pass & "';")

; run, no error
Oracle_Exec("SELECT 2 + 3 FROM dual")

; crash!!!
Oracle_Exec("SET HEADING ON")

Func Oracle_Exec($sql)
    Local $aRet
    Local $ADORS = ObjCreate("ADODB.Recordset")
    $ADORS.CursorType = 2
    $ADORS.LockType = 3
    $ADORS.Open($sql, $ADO)
    While Not $ADORS.EOF
        For $ii = 0 To $ADORS.Fields.Count - 1
            ConsoleWrite($ADORS.Fields($ii).Name & "[" & $ADORS.Fields($ii).Value & "]" & @TAB)
        Next
        ConsoleWrite(@CR)
        $ADORS.MoveNext
    WEnd
    $ADORS.Close
EndFunc   ;==>Oracle_Exec

$ADO.Close

 

I found an explanation "SET HEADING ON" (or similar) is not a SQL (DML, DDL, etc...), is a SQLPLUS command, does not have support.

See this.

 

Edited by Luigi

Visit my repository

Posted

Did you try my ADO.au3 UDF ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...