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 6576149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:28:31+00:00 2026-05-25T15:28:31+00:00

Public Shared Function GetData(ByVal id As Integer) As List(Of SomeClass) Dim command As New

  • 0
 Public Shared Function GetData(ByVal id As Integer) As List(Of SomeClass)
            Dim command As New OracleCommand       
            Dim conn As New OracleConnection(WebConfigurationManager.ConnectionStrings("ConnectionString").ToString)
            Dim param As New OracleParameter
            param.ParameterName = "idnumber"
            param.Value = id
            param.DbType = DbType.Int32
            command.Parameters.Add(param) 

            command.Connection = conn
            command.CommandText = "select VAL1, VAL2, Year from local.proc where id = :idnumber and Year = to_number(to_char(sysdate,’YYYY’))"

            Dim reader As OracleDataReader
            Dim someList As New List(Of SomeClass)

            connection.Open()
            reader = command.ExecuteReader()
            While reader.Read
                Dim someClass As New SomeClass
                someClass.VAL1 = reader("VAL1")
                someClass.VAL2 = reader("VAL2")
                someClass.Year = reader("YEAR")
                someList.Add(someClass)
            End While
            connection.Close()
            Return someList
        End Function

This function is giving an ORA-00911 invalid character error. I have other methods of the same style and these are functioning correctly. Any advise on where I am going wrong here please? Thanks

  • 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-05-25T15:28:32+00:00Added an answer on May 25, 2026 at 3:28 pm

    I think the issue is with the wrong quotes in the SQL statement for the year i.e. : ’YYYY’

    Change it to 'YYYY'

    Replace the line:

    command.CommandText = "select VAL1, VAL2, Year from local.proc where id = :idnumber and Year = to_number(to_char(sysdate,’YYYY’))"
    

    with

    command.CommandText = "select VAL1, VAL2, Year from local.proc where id = :idnumber and Year = to_number(to_char(sysdate,'YYYY'))"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my function ( updated ): Public Shared Function shortenUrl(ByVal URL As String)
Function: Public Shared Function ConvertoDate(ByVal dateString As String, ByRef result As DateTime) As Boolean
Consider I have a shared function:- Public Shared Function CalculateAreaFromRadius(ByVal radius As Double) As
I have this function that returns a DataTable : Public Shared Function GetDataTable(ByVal PageSize
I have the following code: Public Shared Function GetAvailableManufacturers() As List(Of Manufacturer) 'first get
public static void main(String[] args) { List<? extends Object> mylist = new ArrayList<Object>(); mylist.add(Java);
The method signature for Date.TryParse is: Public Shared Function TryParseExact ( _ s As
We have a VB.net function with the following signature in class InitializerFactory: Public Shared
Using the obsolete System.Web.Mail sending email works fine, here's the code snippet: Public Shared
My mac has folders Shared and Public folders. Their permissions are drwxr-xr-x+ for Public

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.