0

I am using embedded C: the following query returns a strange SQLcode -284

  EXEC SQL
   select  *
   into    :xx
   from    xx
   where ....

if (SQLCODE < 0)
  { 
    err_log( "code %ld sqlerrmc %s",sqlca.sqlerrm.sqlerrml,sqlca.sqlerrm.sqlerrmc);
    db_error("");
    return -1;
  }

the error log was: code 4 sqlerrmc SQL error -284 on line 2803

Could you please support me ?

RBarryYoung
  • 55,398
  • 14
  • 96
  • 137

1 Answers1

0

From the PostgreSQL Web site describing the SQLCA:

-284 (ECPG_INFORMIX_SUBSELECT_NOT_ONE) A result of the subquery is not single row (Informix compatibility mode). (SQLSTATE 21000)

I found this within two minutes of googling "PostgreSQL embedded sql -284". I'd suggest you make more of an effort to find primary documentation such as this over asking the question on SO.

John Bode
  • 119,563
  • 19
  • 122
  • 198
  • Is the clause **between** could be a SUBSELECT ? the query is like that: select * into xx from xx where column1 = :vaulex and column2 between :value1 and :value2; – The smart Eagle Aug 18 '14 at 15:52
  • @ThesmartEagle: The problem is that your query is returning multiple rows, but you're writing to an object that can only store one rows' worth of data. You either need to tighten your query so that it only returns a single row, or you need to use a cursor. – John Bode Aug 18 '14 at 16:48