Getting a Sequence back from an S-P with typed DataSet problem

Hi,
I know there are loads of topics about sequences on this forum, but I can't seem to find this exact issue amongst them.
As a learning exercise, I've created a typed dataset based on the HR sample database tables Departments and Employees (through the use of the hack to get an OracleDataAdapter to generate typed datasets).
I currently have a problem with retrieving the new sequence value from the 'Insert_Department' stored procedure I've written, and the best thing I can figure is that there is a clash occurring between the type and size of the sequence and the size of the department_id column (number(4) - which maps in .Net to an int16).
The exception I get on running the dataAdapter.Update() method is:
Unable to cast object of type 'Oracle.DataAccess.Types.OracleDecimal' to type 'System.IConvertible'. Couldn't store <330> in DEPARTMENT_ID Column. Expected type is Int16
The record does get inserted into the database ok - therefore I infer that this is a problem with the handling of the return value back to the DepartmentsDataSet column.
My stored procedure is as follows:
PROCEDURE "INSERT_DEPARTMENT" (
"NEW_DEPARTMENT_ID" OUT DEPARTMENTS.DEPARTMENT_ID%TYPE,
"NEW_DEPARTMENT_NAME" IN VARCHAR2,
"NEW_MANAGER_ID" IN NUMBER,
"NEW_LOCATION_ID" IN NUMBER) IS
BEGIN
INSERT INTO DEPARTMENTS(DEPARTMENT_ID, DEPARTMENT_NAME, MANAGER_ID, LOCATION_ID)
VALUES (DEPARTMENTS_SEQ.NEXTVAL, NEW_DEPARTMENT_NAME, NEW_MANAGER_ID, NEW_LOCATION_ID);
SELECT DEPARTMENTS_SEQ.CURRVAL INTO NEW_DEPARTMENT_ID
FROM DUAL;
END "INSERT_DEPARTMENT";
I've tried lots of different things here; I started declaring the parameter as a NUMBER, now it's set to a %TYPE on the column as you can see... and I've also tried assigning the NEXTVAL to a NUMBER(4) local variable before assigning it to the OUT parameter.
Here's the C# that configures the insert command:
// Insert - note that department_id param is an output param
OracleCommand insert = new OracleCommand("odp_hr_dal.insert_department", connection);
insert.CommandType = CommandType.StoredProcedure;
insert.Parameters.Add(new OracleParameter("new_department_id", OracleDbType.Int16, 2, "department_id"));
insert.Parameters["new_department_id"].Direction = ParameterDirection.Output;
insert.Parameters.Add(new OracleParameter("new_department_name", OracleDbType.Varchar2, 30, "department_name"));
insert.Parameters.Add(new OracleParameter("new_manager_id", OracleDbType.Int32, 4, "manager_id"));
insert.Parameters.Add(new OracleParameter("new_location_id", OracleDbType.Int32, 4, "location_id"));
deptDataAdapter.InsertCommand = insert;
The key line is the adding of the "new_department_id" line where I have tried many different types in the vain hope that I can somehow override the conversion process to not think it needs to go as large as a Decimal type.
I wonder if anyone could help point me towards the (probably obvious) thing that I am missing? I've run out of ideas on things to try!
With Best Regards,
Nij

Thank you muylaerk,
That did work.
However, this and the related link you posted raise a question: Given that (in the case of Decimal types) whichever of the DbType or OracleDbType property you set, the other value is set to Decimal also... what setting in the OracleParameter records which was the 'set' property, and therefore, which type will the Value be set to?
In other words, does anything visibly change in the debugger view of the OracleParameter type to see this?
Nij

Similar Messages

  • Not getting a reply back from a BAPI call

    Hi all;
    I am trying to call a BAPI from xMII which has its input parameter as  from and to dates.I passed in the dates in format DDMMYYYY but am unable to get a reply back from BAPI.
    Same thing is working when i execute the BAPI with the same parameter in R/3 system.
    Please help.
    Mudit

    Mudit
    Did u hv defined Transaction Input parameter with Data Type DateTime which is used to be passed to BAPI request item.
    Pls do check the LastErrorMessage using Tracer (see the tracer logs after hitting F5/F6)
    IlluminatorDocument(With one string param defined)
    SAPJCOInterface(With BAPI call and input param passed in date format)
    <b>Tracer (LastErrorMessage mapped to the mesage) </b>
    IlluminatorRow(Reply from bapi mapped to output param)
    Assignment
    One thing more, y r u not using Repeater action which is used to loop the response from BAPI call and within the loop, use Row action to append the response item the XML Document defined in the first sequence. (Hope, u remember my that guided doc in some prvious thread posted to u where full guide with steps are provided)
    Regards
    Som

  • How do you get your money back from a charge you never even made on the app store?

    How do you get your money back from a charge you never even made on the app store?

    Contact iTunes.
    How to report an issue with Your iTunes Store purchase

  • My computer broke down and now i bought a new  Mac,  how can i get my music back from iTunes??

    my computer broke down and now i bought a new  Mac,  how can i get my music back from iTunes??

    Unless you subscribe to iTunes Match , Apple does not keep a backup of your iTunes library.  Even then it is not the library as it exists on your computer, but some version of the media, and only media files, not playlists.  Even then not all media are definitely available since anything removed from the iTunes Store since you purchased it is not available for re-download.
    FAQ: Why iTunes Match Can Not Be Used as a Backup - https://discussions.apple.com/docs/DOC-4112
    Using Match as a backup for iTunes - https://discussions.apple.com/message/17039436#17039436
    In your case it sounds like you will have to obtain non iTunes purchases from their original source or a backup you may have made at some time in the past.

  • I have updated my mac from snow leopard to mountain lion 3 days back. I had some important data in my library folder and it got overwritten. Is there any way i can get the data back from my snow leopard library folder?

    I have updated my mac from snow leopard to mountain lion 3 days back. I had some important data in my library folder and it got overwritten. Is there any way i can get the data back from my snow leopard library folder?
    I tried mackeeper to recover files but it could not. Any other way any one has tried to recover a system library folder after OS upgrade?

    No, it doesn't store a clone. You would have needed to make one with either SuperDuper or CarbonCopy Cloner.
    If the files were in your ~/Library folder then they may still be there. As I said, you can access it by
    going to your Finder "Go" menu hold the option key to choose "Library". I wouldn't think an upgrade would overwrite anything in ~/Library.
    If you have a Time Machine backup you may also be able to use that to retrieve them.

  • How can I get the data back from my game

    How can I get the data back from minecraft if I deleted the app and bought with a different Apple ID

    No, they are tied to the ID that purchased them, and cannot be transferred to anyone else.

  • My old computer crashed and needed replaced, how do i get my library back from the old one and put on the new one?i had xp now windows 7

    my old computer crashed, it was xp i replaced it with windows 7 how do i get my library back from the old computer and put on the new one?

    iDevices are not backup devices.
    Use the backup of the computer to put everything back.

  • Ok I can't seem to get my apps,music, or photos from my iCloud from when I first setup iCloud on a iPhone 4. How do I get my things back from the iCloud and get them to my new device?

    Ok I can't seem to get my apps,music, or photos from my iCloud from when I first setup iCloud on a iPhone 4. How do I get my things back from the iCloud and get them to my new device?

    If you no longer have the phone or have any Backup of it at all, you can re-download your apps and your content from the iTunes Store by logging into your Apple ID at settings> iTunes & App Store. Unfortunately you can no longer recover the data that was associated with those apps.
    So far as your photos go, you can recover any photos that were in photo stream and taken less than 30 days ago by logging in with your Apple ID to settings> iCloud> photos. Unfortunately you will be unable to recover any photos from your camera roll.

  • How do i get my contacts back from io5 update on my iphone 4

    how do i get my contacts back from io5 update on my iphone 4

    Although contacts are included with the iPhone's backup, contacts are designed to be synced with a supported address book app on your computer and/or over the air with an email account that supports it, and there are several that do which are free.
    Not a good idea to depend on the iPhone or any cell phone alone for contacts which can be lost or stolen or damaged beyond repair. If the contacts are available elsewhere as designed and intended, it doesn't matter if there is a problem with your iPhone's backup in regards to this data.

  • Can you get your money back from itunes

    Can you get your money back from itunes

    if you purchase a itunes gift card you will not be able get your money back. unless if it has never been used, such as enetering the bar code then you can probably take it in to the original store where you bought it from with the receipt. 

  • TS4009 How do I get my money back from an iCluod storage plan upgrade that I don't want?

    How do I get my money back from an iCluod storage plan upgrade that I don't want?

    You can cancel an iCloud storage upgrade within 15 days of buying:
    Apple have made this as difficult as possible. However two posters have managed to achieve this. Elizellen was able to use Express Lane to get a refund:
    https://discussions.apple.com/message/19323996#19323996
    However if you use Express Lane may find you cannot proceed without entering a hardware serial number which is still eligible for AppleCare.  julia22 managed to find a way round that by phoning them - please see this post:
    https://discussions.apple.com/message/16968425#16968425
    it gives the USA number - if you don't live there you will have to find an equivalent number from the 'Contact Us' link at bottom right of this page.
    If it is more than 15 days since you purchased the storage you cannot cancel it for a refund; you can downgrade your plan as from your next renewal date. Please see
    http://help.apple.com/icloud/#mmd602084a
    and expand 'Downgrade your storage for the next plan year'.

  • HT204088 how do I get my money back from an apllication I did't buy?

    How do I get my money back from an aplication I didn't buy?

    Try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • How do you get old emails back from the cloud storage

    how do you get old emails back from the cloud storage

    How did you get them into cloud storage?

  • HOW DO i GET MY MONEY BACK FROM A TV SHOW THAT WON'T PLAY!!!

    How do I get my money back from a tv show that is downloaded and paid for but WILL NOT PLAY.  It skips through entire episode in 20 SECONDS!  I WOULD APPRECIATE AN ANSWER.

    I am waiting for an answer! This is ridiculous!

  • How can I get my money back from an app

    How do I get my money back from an app tht my daughter accidentally bought.

    All sales are final.
    You can try contacting itunes support and asking for an exception.
    Click Contact Us at the bottom of this page

Maybe you are looking for

  • Problem in parsing white spaces using if_ixml_parser

    Hello People, I have a problem in parsing XML file in one of my programs. The program uses the method get_value( ) of class if_ixml_node to fetch a value. In the XML file when the value is spaceA, then after parsing, the value fetched is A and not sp

  • Pixelated Images Printing

    I am new to Pagemaker and Im trying to create a little flyer for my youth group. The images are all jpegs, and when I use the 'Place' option they were showing up fuzzy. So I changed the view to 'high resolution' and now they look great on screen. But

  • Payment using voucher

    Hi All, i have some problem about how to make payment sales with voucher. The voucher will considered to be advance payment. Can we treat that voucher as payment card ? I need all advice and your experience about how to make this business model in SA

  • Blackberry​curve 9220 location service by mobile networks

    I would like to if curve 9220 shows our location in google maps via mobile networks or wifi Solved! Go to Solution.

  • External Table to Internal table Data update query

    Hi all , I have Follwoing 2 tables one is external oracle and 2nd is internal and both table have the same data as following this is sample data while actual table contains millions of record. External Table name SE2_EXT         GL_REF_NO     GL_CUST