473,396 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.Text (not a storeproc).

DECLARE curval number;
BEGIN INSERT INTO UTILISATEUR_GADGET
(uiduser,instance,couleur,gadget,idpage,colonne,li gne,param,dateupdate)
values ('B020964','',0,'feedrss.htm',4,2,0,'',TO_TIMESTAM P('22/02/2008
07:42:40','DD/MM/YYYY HH24:MI:SS'));
select UTILISATEUR_GADGET_SEQ.currval into curval from DUAL; END;

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

Any help ?

Stan

Feb 22 '08 #1
1 2827
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.Text (not a storeproc).

DECLARE curval number;
BEGIN INSERT INTO UTILISATEUR_GADGET
(uiduser,instance,couleur,gadget,idpage,colonne,li gne,param,dateupdate)
values ('B020964','',0,'feedrss.htm',4,2,0,'',TO_TIMESTAM P('22/02/2008
07:42:40','DD/MM/YYYY HH24:MI:SS'));
select UTILISATEUR_GADGET_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
Feb 22 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: cmo63126 | last post by:
Why am I not able to retrieve the value of ID (which does exist) using ExecuteScalar()? Do i simply have to use ExecuteReader() instead? My problem snippet: string mySQL = "SELECT ID FROM...
2
by: WeiminZhang | last post by:
When I use the OleDb to connect a Oracle db, and use the ExecutScalar() method to get the count of a table, the return value can't be cast to a data type, say int, while this works fine for a SQL...
3
by: AL | last post by:
Hello. I've been programming in C# for about 6 months, and I have a question; I was experimenting with some code this evening, for example this; this.sqlConnection1.Open(); int qty = (int)...
2
by: Dinesh | last post by:
Hi, I have one stored procedure in SQL server in which i have written one insert statement. Now in my cs file i pass the parameters require to execute that stored procedure and finaly by mistaken...
6
by: Max | last post by:
Anyone know why I'm always getting 0 returned? My stored procedure returns -1. Dim iErrorCode As Int32 iErrorCode = Convert.ToInt32(SqlHelper.ExecuteScalar(AppVars.strConn, _ "gpUpdateMember",...
7
by: Neven Klofutar | last post by:
Hi, I have a problem with SqlHelper.ExecuteScalar ... When I try to execute SqlHelper.ExecuteScalar I get this message: "System.InvalidCastException: Object must implement IConvertible.". ...
5
by: bienwell | last post by:
Hi all, I have a problem with using myCommand.ExecuteScalar(). My question is : If the Web setup is incorrect, does it make command ExecuteScalar() work improperly ?? In my program, I was...
3
by: charliewest | last post by:
Hi - I need to detect when the ExecuteScalar() method of the cmd object returns NULL. I have tried the below code, however, it always returns false (this is to say, that ExecuteScalar never...
2
by: Manikandan | last post by:
Hi, I have a table with following data Tablename:details No(varchar) Name(varchar) Updated(Datetime) 1 mm 10/10/2006 2 nn 02/12/2005 3 kk NULL I'm using executescalar to get the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.