The query syntax is not valid., near identifier 'SESSION

The query syntax is not valid., near identifier 'SESSION

Postby Wupaz » Wed 16 Dec 2009 19:54

I do the same thing with Orace driver (MSFT) and it work perfectly !

Sample code

var command = model.Connection.CreateCommand();
command.Connection.Open();
var tns = model.Connection.BeginTransaction();

command.Connection = model.Connection;

command.CommandType = CommandType.Text;
command.CommandText = @"ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS';";
command.Transaction = tns;
command.Parameters.Clear();

command.ExecuteNonQuery();
Wupaz
 
Posts: 8
Joined: Fri 19 Sep 2008 13:36

Postby StanislavK » Thu 17 Dec 2009 16:35

Please remove the semicolon from the CommandText, this will be

Code: Select all
command.CommandText = @"ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'";

dotConnect for Oracle doesn't parse OracleCommand.CommandText, thus the command with a semicolon is interpreted as a PL/SQL block and hence causes an error. If you do want to use a PL/SQL block, please use the OracleScript class.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for Oracle