Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9022427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:30:29+00:00 2026-06-16T05:30:29+00:00

As the code Shows below, I want to insert a row into a database

  • 0

As the code Shows below, I want to insert a row into a database table (oracle 11) and return a String-Value of the inserted row.

using (OracleCommand cmd = con.CreateCommand()) {
    cmd.CommandText = "insert into foo values('foo','bar') returning idString into :lastIdParam";
    cmd.Parameters.Add(new OracleParameter("lastIdParam", OracleDbType.Varchar2), ParameterDirection.ReturnValue);
    cmd.ExecuteNonQuery();  // returning 1 (insert row successfully)

    var result = cmd.Parameters["lastIdParam"].Value.ToString();   // == String.Empty
}

Debugging shows that lastIdParam.Value’s value = Empty.String:
enter image description here

My Problem is, that I’m not getting the return string into my return-parameter but it will work when returning an integer value (like sequence no of inserted id). Cast Problem? …?

The idString is filled if running the Statement directly (or if I just do something like returning 'ABC' into :myOutputParameter

Any ideas how to retrieve a string after inserting row?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:30:30+00:00Added an answer on June 16, 2026 at 5:30 am

    Have you tried setting a size for the parameter? The default size is 0.

    new OracleParameter("lastIdParam", OracleDbType.Varchar2, 128)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The example below shows the code I am using to test whether a user
The code shows below what i have done till now. Now what i need
The code below shows me (I think) that the for each loop is about
The code below compiled in Debug configuration in VS2005 SP1 shows two messages with
The code below extracts links from a web page and shows them in a
I have the code below that hides and shows the navigational bar. It is
The code below is in WPF in .net 4, which shows a grid which
I changed the code shown below into ARC compatible. I just changed it as
i want copy data from from a detailsview(tableName=Jobs) to another table(tablename=Company) But it shows
Ii'm using this NSURL code to display an image. what I want to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.