Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Error when executing a simple Oracle Command

Error when executing a simple Oracle Command

Scheduled Pinned Locked Moved C / C++ / MFC
databaseoraclehelpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Reveille
    wrote on last edited by
    #1

    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?

    P M R 3 Replies Last reply
    0
    • R Reveille

      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?

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      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...

      1 Reply Last reply
      0
      • R Reveille

        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?

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        It's not the semicolon is it?

        R 1 Reply Last reply
        0
        • M Mark Salsbery

          It's not the semicolon is it?

          R Offline
          R Offline
          Reveille
          wrote on last edited by
          #4

          :( nope, Ive tried it without the semicolon already.

          1 Reply Last reply
          0
          • R Reveille

            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?

            R Offline
            R Offline
            Reveille
            wrote on last edited by
            #5

            I rebooted my comp this morning and ran it without the semicolon again and it worked :-D Thanks for the replys!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups