Error when executing a simple Oracle Command
-
I'm creating a program that stores packets into an oracle DB. When I try to get a count of how many entries are in my 'packet' table I receive an "ORA-00911: invalid character" exception. Oracle describes this error: ORA-00911: invalid character Cause: identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual. And my code that causes the error.... { String *cmdString = S"SELECT COUNT(*) AS rowcount FROM packet;"; OleDb::OleDbCommand *oracleCommand1 = new OleDb::OleDbCommand(); oracleCommand1->Connection = oracleConnection; oracleCommand1->CommandText = cmdString; oracleConnection->Open(); gPacketCount = Convert::ToInt64(oracleCommand1->ExecuteScalar()); } Is the asterisk in 'COUNT(*)' causing my error? If so, is there another way to get a row count?
-
I'm creating a program that stores packets into an oracle DB. When I try to get a count of how many entries are in my 'packet' table I receive an "ORA-00911: invalid character" exception. Oracle describes this error: ORA-00911: invalid character Cause: identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual. And my code that causes the error.... { String *cmdString = S"SELECT COUNT(*) AS rowcount FROM packet;"; OleDb::OleDbCommand *oracleCommand1 = new OleDb::OleDbCommand(); oracleCommand1->Connection = oracleConnection; oracleCommand1->CommandText = cmdString; oracleConnection->Open(); gPacketCount = Convert::ToInt64(oracleCommand1->ExecuteScalar()); } Is the asterisk in 'COUNT(*)' causing my error? If so, is there another way to get a row count?
cpp_and_asm wrote:
Is the asterisk in 'COUNT(*)' causing my error?
Not sure what is causing your error, but I doubt the asterisk isn't the problem...
-
I'm creating a program that stores packets into an oracle DB. When I try to get a count of how many entries are in my 'packet' table I receive an "ORA-00911: invalid character" exception. Oracle describes this error: ORA-00911: invalid character Cause: identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual. And my code that causes the error.... { String *cmdString = S"SELECT COUNT(*) AS rowcount FROM packet;"; OleDb::OleDbCommand *oracleCommand1 = new OleDb::OleDbCommand(); oracleCommand1->Connection = oracleConnection; oracleCommand1->CommandText = cmdString; oracleConnection->Open(); gPacketCount = Convert::ToInt64(oracleCommand1->ExecuteScalar()); } Is the asterisk in 'COUNT(*)' causing my error? If so, is there another way to get a row count?
It's not the semicolon is it?
-
It's not the semicolon is it?
-
I'm creating a program that stores packets into an oracle DB. When I try to get a count of how many entries are in my 'packet' table I receive an "ORA-00911: invalid character" exception. Oracle describes this error: ORA-00911: invalid character Cause: identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual. And my code that causes the error.... { String *cmdString = S"SELECT COUNT(*) AS rowcount FROM packet;"; OleDb::OleDbCommand *oracleCommand1 = new OleDb::OleDbCommand(); oracleCommand1->Connection = oracleConnection; oracleCommand1->CommandText = cmdString; oracleConnection->Open(); gPacketCount = Convert::ToInt64(oracleCommand1->ExecuteScalar()); } Is the asterisk in 'COUNT(*)' causing my error? If so, is there another way to get a row count?