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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:56:35+00:00 2026-06-14T04:56:35+00:00

I am trying to get the default value for a column but unfortunately I

  • 0

I am trying to get the default value for a column but unfortunately I get nothing.
Here is my code:

'ColumnName is the Column Name in question
'BaseTableName is the Table Name
   Dim myCon As New OracleConnection
   myCon.ConnectionString = gApp.ConnectString
   myCon.Open()
   Dim myCmd As New OracleCommand
   myCmd.Connection = myCon
   myCmd.CommandType = CommandType.Text
   myCmd.CommandText = "select data_default " & _
          "from all_tab_columns " & _
          "where table_name='" & BaseTableName & "' " & _
          "and column_name='" & ColumnName & "'"
   Dim dr As OracleDataReader
   dr = myCmd.ExecuteReader
   dr.Read()
   Dim val = dr.GetValue(0).ToString

   '  Dim val = myCmd.ExecuteScalar 'I tried also with executeScalar but it was the same

   myCon.Close()

When I execute the same string in oracle it returns a Long and inside the long is the default value
the result in oracle

How can I get the original value inside the long?

  • 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-14T04:56:36+00:00Added an answer on June 14, 2026 at 4:56 am

    Assuming the problem is because your environment doesn’t support LONGs, you can create a function to convert the value to a VARCHAR2 first. For example:

    create table test1(a number default 0);
    
    create or replace function get_data_default(
        p_owner varchar2,
        p_table_name varchar2,
        p_column_name varchar2
    ) return varchar2 authid current_user is
        v_data_default varchar2(4000);
    begin
        select data_default
        into v_data_default
        from all_tab_columns
        where owner = p_owner
            and table_name = p_table_name
            and column_name = p_column_name;
    
        return v_data_default;
    end;
    /
    
    select get_data_default(USER, 'TEST1', 'A') from dual;
    
    0
    

    If you have this problem with other columns, you can make the function more generic, or you can look into a utility to convert all the dictionary LONGs to CLOBs. The Dictionary Long Application can do this, although it can get very complicated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get a default query to implement upon page load but
I am trying to get the Default Constraints information for a given table. I
I am trying to get the node ref of file uploaded to default root
I'm trying to get the new ASP.NET Web API beta (VS 2010 default Web
I have a table with this column: last_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON
Here is an example of the XML I'm trying to get some values from:
I'm trying to map inheritance with discriminator, but subclasses don't have discriminator value. How
I am trying to add default values to a group of columns, but I
I am trying to fetch the minimum value of a column in MySQL using
So i'm trying to understand all the code from the NotePad sample, but i'm

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.