473,811 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fetching field information from oracle db

Hi there,

as I am trying to write a recordset class, I am interested in fetching
field information from an oracle db. Several information on the fields
are very simple to request. So I already receive the field properties
name, max_length, type not_null, has_default and defaul_value. This is
achieved by using functions like oci_field_name( ). But I am not able to
request the information on if the field is primary key or marked as
unique key.

Is there a way to fetch the properties unique and primary key?

thanks,
;) Florian

Feb 13 '06 #1
2 1408
On Mon, 13 Feb 2006 00:33:14 -0800, Florian Albrecht wrote:
Is there a way to fetch the properties unique and primary key?


select col.owner,col.t able_name,col.c olumn_name,col. constraint_name
from dba_constraints con,dba_cons_co lumns col
where con.owner=col.o wner and
con.table_name= col.table_name and
con.constraint_ name=col.constr aint_name and
con.constraint_ type in ('P','U') and
con.table_name= :TABLE and
con.owner=:OWNE R

You can user all_constraints and all_cons_column s instead the dba
varieties, even LUSER_CONSTRAIN TS and LUSER_CONS_COLU MNS.
--
http://www.mgogala.com

Feb 13 '06 #2
Mladen Gogala wrote:
On Mon, 13 Feb 2006 00:33:14 -0800, Florian Albrecht wrote:

Is there a way to fetch the properties unique and primary key?

select col.owner,col.t able_name,col.c olumn_name,col. constraint_name
from dba_constraints con,dba_cons_co lumns col
where con.owner=col.o wner and
con.table_name= col.table_name and
con.constraint_ name=col.constr aint_name and
con.constraint_ type in ('P','U') and
con.table_name= :TABLE and
con.owner=:OWNE R

You can user all_constraints and all_cons_column s instead the dba
varieties, even LUSER_CONSTRAIN TS and LUSER_CONS_COLU MNS.

--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
Feb 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2645
by: Sachin | last post by:
I am trying to fetch the font information using following code private void Form1_Load(object sender, System.EventArgs e) { IntPtr hdc = Win32API.GetDC(this.Handle); try { LOGFONT lf = CreateLogFont("");
0
899
by: remcoploeg | last post by:
I use the following code for getting a picture from oracle: OraCon.Open(); // define the sql to perform the database insert string sqlStmt = "select foto from ov_portal_foto"; // Establish a new OracleCommand OracleCommand cmd = new OracleCommand(); // Set command to create your SQL statement
0
1263
by: Utilisateur1 | last post by:
Hello, I've a problem retrieving a blob column from oracle. I'm using oledbadapter to fill a dataset like that oledataadap.fill(ds,"query"); I'm also using ColumnMapping to have more friendly column headers in dataset. The Fill method send an error with no explaznation except this "the type is not managed". Has somebody ideas about to solve that ?
22
2752
by: Sandman | last post by:
So, I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other things. So, in instances where I list, for example, the latest weblogs. I list the headline of the weblog, the date and the name of the member who wrote it. Now, the name isn't just "Smith", but rather Smith's online status, his nick and his...
0
1590
by: =?Utf-8?B?SGF3aw==?= | last post by:
Hello, I have the need to verifiy a field in a gridview for a duplicate value against a database before the update takes place. I was thinking that the gridview1.rowupdating would be a good place to put code that can check for duplicate data before the update happens. Below is a sample of the code i was trying but did not work. Protected Sub gvAssignedZones_RowUpdating(ByVal sender As Object, ByVal e As...
9
9762
by: renisha | last post by:
I am trying to retreive a string in this format dd-MM-yyyy hh:mm:ss a from Oracle database from the column of type Date which has value 10/09/2007 07:11:16 Date strfinaldate = new java.util.Date(rs.getTimestamp(10).getDate()+rs.getTimestamp(10).getTime()); SimpleDateFormat sf = new SimpleDateFormat ("dd-MM-yyyy hh:mm:ss a"); String formatteddate = sf.format(strfinaldate ); But I am getting the o/p as 10-09-2007 12:00:00 am Please...
1
1595
by: kababoom | last post by:
I'm running Oracle 9i i would like to import one particular field stored in a excel format (which contains many fields) into oracle is there any command i could use to perform this task? Thanks for any info
8
1848
by: Ampridge | last post by:
I am trying to keep a log of records that I have deleted. I am trying to find a way to create an array of "CustomerID "(autonumber field) that stores information of the records selected when I hit the delete button. To further complicate the process the CustomerID number is part of the record source but is not on the form. Any suggestions would be appreciated.
0
9730
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10392
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.