Executing statement and commiting statement via qtp - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Executing statement and commiting statement via qtp (/Thread-Executing-statement-and-commiting-statement-via-qtp) |
Executing statement and commiting statement via qtp - unbeliever - 01-07-2010 Hello All, I am connecting to DB and trying to execute statement: Code: strQuery = "exec STATEMENT" Please note that this is not a SELECT statement. I am getting error message that SQL statement is invalid, though I can successfully execute same statement in SQL Plus. Can you please advise me proper syntax how to execute this statement and after that commit changes to DB with code sample? RE: Executing statement and commiting statement via qtp - Saket - 01-07-2010 try this, may be it can help you Code: Set oConnection = CreateObject("ADODB.Connection") RE: Executing statement and commiting statement via qtp - unbeliever - 01-07-2010 Thanks, I've tried but outcome is the same: Code: ORA-00900: Invalid SQL Statement RE: Executing statement and commiting statement via qtp - Saket - 01-07-2010 I doubt there is something wrong in your exec staement. Can you paste exeactly what you are trying here? RE: Executing statement and commiting statement via qtp - unbeliever - 01-07-2010 Actually there can be a problem, sql statements which are executable in SQL Plus require different syntax in SQL Developer, otherwise - cannot be executed and result in exactly the same manner: Invalid SQL statement. For example: - in SQL Plus I execute statement like this: exec statement - in SQL Developer I wrap statement: Code: begin; As for my current code it's below: Code: Dim oConn RE: Executing statement and commiting statement via qtp - Saket - 01-07-2010 Yes, I agree that syntax could be different for some or the other application but this should not be the case when you are doing it through the script. like as in the example you said in SQL Developer you need to wrap, this is the way sql developer tells server to execute the statement. anyways are you able to execute the same statement on either of the the application ie SQL plus or sql dev bcoz what i found about ORA-00900: invalid SQL statement is "The statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed. " which i beleive is a syntax error and correcting that should solve the issue. let me know your comments on this. RE: Executing statement and commiting statement via qtp - unbeliever - 01-07-2010 Working solution is: Code: Dim oConn See oCommand.CommandText line for modifications: exec word was removed. |