Home » Developer & Programmer » Precompilers, OCI & OCCI » ORA-01722 while trying to insert values from structure
ORA-01722 while trying to insert values from structure [message #93932] Fri, 18 April 2003 09:49
Anna
Messages: 30
Registered: March 2001
Member
ORA-01722 while trying to insert values from structure

Hello --

I have the following select (in cursor), which is fetched into a structure:

j=0;
EXEC SQL DECLARE cursor_sel_elig_students CURSOR FOR
SELECT SLBRMAP_FROM_TERM,
SPRIDEN_PIDM,
TO_DATE(TO_CHAR(SLBRMAP_ADD_DATE, 'MM/DD/YYYY HH:MI:SS AM'),
'MM/DD/YYYY HH:MI:SS AM'),
DECODE(SZVHCLA_CODE, '1A', 1, '1B', 2, '1', 3)

FROM SPRIDEN, SLBRMAP, SARAPPD, SZVHCLA

for(;;)
{

elig_students[[j]] =
(struct elig_students_struc*)malloc(sizeof(struct elig_students_struc));

EXEC SQL FETCH cursor_sel_elig_students
INTO :elig_students[[j]]->term_code,
:elig_students[[j]]->pidm,
:elig_students[[j]]->date_time,
:elig_students[[j]]->hcla_code;
EXEC SQL
INSERT INTO SZRRMAT
(SZRRMAT_TERM_CODE,
SZRRMAT_PIDM,
SZRRMAT_ACTIVITY_DATE,
SZRRMAT_HCLA_CODE)
VALUES (:elig_students[[j]]->term_code:,
:elig_students[[j]]->pidm,
to_date( to_char(:elig_students[[j]]->date_time,'MM/DD/YYYY HH:MI:SS AM'),'MM/DD/YYYY HH:MI:SS AM'),
:elig_students[[j]]->hcla_code);
j++;

free(elig_students[[j]]);

--I basically need to insert the date in the format 'MM/DD/YYYY HH:MI:SS . I get the following error: ORA-01722: invalid number while trying to insert. If I do not cast in the INSERT statement then I do not get the error, but the date gets inserted without the hours and minutes in a format 'MM/DD/YYYY'. What can be wrong?

thank you in advance,
Previous Topic: Is there way to get enhanced info from (instead of) OCIErrorGet() ?
Next Topic: Precompilation
Goto Forum:
  


Current Time: Mon May 27 11:53:48 CDT 2024