Search code examples
c++oracleora-00932

how to excute a simple query use sqlapi++ with oracle


here is the code:

cmd1.setCommandText("select * from lp.human_tb_meta_sex"); cmd1.Execute();

while (cmd1.FetchNext()) { SAString sas=cmd1.Field("id").asString(); cout<<"sas id:"<

it gave me ORA-00932 error...I dont know why..?


Solution

  • Presumably "id" is the primary key.

    If it is defined as a NUMBER in the database, that could include fractions (eg 3.5).

    If you define it as NUMBER(10,0) then it will always be an integer.

    Since you are trying to pull it out as a String [.asString()] there could be a conversion issue.