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

  • Home
  • SEARCH
  • 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 99193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:20:26+00:00 2026-05-11T00:20:26+00:00

I have the following Oracle function: function get_job_no return number is V_job_no number; begin

  • 0

I have the following Oracle function:

function get_job_no return number is         V_job_no number;       begin          select appwork.tlm_corphier_job.nextval into V_job_no from dual;          return V_job_no;       end get_job_no; 

PLEASE NOTE:
1) This is a FUNCTION, not a procedure
2) This is returning a NUMBER, not a VARCHAR
3) I happen to be using System.Data.OracleClient rather than Oracle.DataAccess.Client (due to another issue I was having) but a solution with either would be fine.

I am trying to call this from VB.Net using the MS enterprise library like so:

Imports Microsoft.Practices.EnterpriseLibrary.Data Imports System.Data.OracleClient     Public Function GetNextJobNumber() As Object         Dim db As Database = DatabaseFactory.CreateDatabase()         Dim myresult As Object = Nothing         Using cmd As DbCommand = db.GetStoredProcCommand('CORPHIER_PKG.get_job_no')             Dim retval As New Data.OracleClient.OracleParameter('retval', GetType(System.Data.OracleClient.OracleNumber))             retval.Direction = ParameterDirection.ReturnValue             cmd.Parameters.Add(retval)             db.ExecuteNonQuery(cmd)             myresult = retval.Value         End Using         Return myresult     End Function 

I get the following error:

System.InvalidCastException: Failed to convert parameter value from a RuntimeType to a Decimal. —> System.InvalidCastException: Object must implement IConvertible. at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at System.Data.OracleClient.OracleParameter.CoerceValue(Object value, MetaType destinationType) — End of inner exception stack trace — at System.Data.OracleClient.OracleParameter.CoerceValue(Object value, MetaType destinationType) at System.Data.OracleClient.OracleParameter.SetCoercedValueInternal(Object value, MetaType metaType) at System.Data.OracleClient.OracleParameterBinding.PrepareForBind(OracleConnection connection, Int32& offset) at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals) at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor) at System.Data.OracleClient.OracleCommand.ExecuteNonQuery() at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteNonQuery(DbCommand command) at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DbCommand command)

  • 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. 2026-05-11T00:20:27+00:00Added an answer on May 11, 2026 at 12:20 am

    Ok, this seems to work:

    Public Function GetNextJobNumber() As Object     Dim db As Database = DatabaseFactory.CreateDatabase()     Using cmd As DbCommand = db.GetStoredProcCommand('CORPHIER_PKG.get_job_no')         db.AddParameter(cmd, 'retval', DbType.Int32, 0, ParameterDirection.ReturnValue, True, 0, 0, String.Empty, DataRowVersion.Current, Convert.DBNull)         db.ExecuteNonQuery(cmd)         Return db.GetParameterValue(cmd, 'retval')     End Using End Function 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 147k
  • Answers 147k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This was resolved by including the Apache Felix Bundle Repository… May 12, 2026 at 9:08 am
  • Editorial Team
    Editorial Team added an answer I suggest to start looking for patterns here. For example,… May 12, 2026 at 9:08 am
  • Editorial Team
    Editorial Team added an answer $fileStr = file_get_contents('/path/not/url/to/script.php'); May 12, 2026 at 9:08 am

Related Questions

So I've got a for loop that processes a list of IDs and has
I have four DB tables in an Oracle database that need to be rewritten/refreshed
I have the following tables: ALERT (ID,Name) 1 | Alert A 2 | Alert
I'd need advice on following situation with Oracle/PostgreSQL: I have a db table with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.