Failing Update Table in Db2 with Sqlcode: -668, Sqlstate: 57016, Sqlerrmc: 7;

DB2 SQL error: SQLCODE: -206, SQLSTATE: 42703

That only means that an undefined column or parameter name was detected. The errror that DB2 gives should point what that may be:

DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=[THE_UNDEFINED_COLUMN_OR_PARAMETER_NAME], DRIVER=4.8.87

Double check your table definition. Maybe you just missed adding something.

I also tried google-ing this problem and saw this:

http://www.coderanch.com/t/515475/JDBC/databases/sql-insert-statement-giving-sqlcode

DB2 ERRORCODE=-4229, SQLSTATE=null

For those who are looking for an solution to this error.

For me this was due to

THE INSERT OR UPDATE VALUE OF FOREIGN KEY constraint-name IS INVALID.
DB2 SQL Error: SQLCODE=-530, SQLSTATE=23503

db2 create index but hit SQLSTATE=42703

As per my comment. You are using double-quotes around the column names the column case (uppercase, lowercase) must match between the table-definition and the index definition.

DB2 SQL, cant define column as

try it

with tmp as (
select T.HATId as "ID",
sum(case when T.ID = 4 or HA.ID < 0 then 1 else 0 end) as sum1,
count(*) as nb
from Hats T
group by T.HATId
)
select HATId, round(cast(sum1 as decimal)/ nb * 100, 2) NewID
from tmp

dblink returns SQL Error [42703]: ERROR: column xy does not exist

This is the select statement you create:

select XXX as name , es.name as service, es.scopes::varchar as scopes from services es

where XXX is the value of rec_key.name - and the value of rec_key.srv in the latter case.

In the former case, the statement evaluates to:

select dba01 as name , es.name as service, es.scopes::varchar as scopes from services es

but in the latter case:

select 100 as name , es.name as service, es.scopes::varchar as scopes from services es

In the former case, the error is issued as the column dba01 does not exist. In the latter case, the number 100 is selected as name. It is a perfectly valid statement as it is not interpreted as a column name.

If you want to select the text value "dba01" as column "name" you can change that part to:

''' || rec_key.name || '''::text as name ,

Best regards, Bjarni

JPA + DB2 can't execute simple query

Solution:

    @Override
@PreAuthorize("hasRole('ROLE_ADMIN')")
public List<HoldingDto> getHoldingList()
{
List<HoldingDto> holdLst = null;
try
{
String aa = (String) q.getSingleResult();

CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<HoldingDto> q = cb.createQuery(HoldingDto.class);
Root<Holding> h = q.from(Holding.class);
q.select(cb.construct(HoldingDto.class, h.get("holdingId"), h.get("holdingName"), h.get("description"), h.get("savesUserId"), h.get("insertDate"),
h.get("updateDate"), h.get("updater"), h.get("RDeleted")));
holdLst = em.createQuery(q).getResultList();
}
catch(NoResultException e)
{
e.printStackTrace();
}
catch (Exception e)
{
throw new RuntimeException(e);
}

return holdLst;
}


Related Topics



Leave a reply



Submit