ExecuteScalar with Oracle

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stan SR

    ExecuteScalar with Oracle

    Hi,

    I m trying to get the last added sequence from an Oracle table with
    executeScalar, but it seems I m doing something wrong.
    Here's my query (that I use with commandType.Tex t (not a storeproc).

    DECLARE curval number;
    BEGIN INSERT INTO UTILISATEUR_GAD GET
    (uiduser,instan ce,couleur,gadg et,idpage,colon ne,ligne,param, dateupdate)
    values ('B020964','',0 ,'feedrss.htm', 4,2,0,'',TO_TIM ESTAMP('22/02/2008
    07:42:40','DD/MM/YYYY HH24:MI:SS'));
    select UTILISATEUR_GAD GET_SEQ.currval into curval from DUAL; END;

    But I always get back a 0 as value (the record is added)

    Any help ?

    Stan

  • Hans Kesting

    #2
    Re: ExecuteScalar with Oracle

    Stan SR explained on 22-2-2008 :
    Hi,
    >
    I m trying to get the last added sequence from an Oracle table with
    executeScalar, but it seems I m doing something wrong.
    Here's my query (that I use with commandType.Tex t (not a storeproc).
    >
    DECLARE curval number;
    BEGIN INSERT INTO UTILISATEUR_GAD GET
    (uiduser,instan ce,couleur,gadg et,idpage,colon ne,ligne,param, dateupdate)
    values ('B020964','',0 ,'feedrss.htm', 4,2,0,'',TO_TIM ESTAMP('22/02/2008
    07:42:40','DD/MM/YYYY HH24:MI:SS'));
    select UTILISATEUR_GAD GET_SEQ.currval into curval from DUAL; END;
    >
    But I always get back a 0 as value (the record is added)
    >
    Any help ?
    >
    Stan
    In the code you show I don't see where you get the "next" value from
    that sequence. So could it be that the value 0 is correct for the code?

    Hans Kesting


    Comment

    Working...