General discussion

Locked

identity

By cedla ·
What is data type identity in SQL? In adding new records with PL/SQL, how do I write it?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

identity

by roc180 In reply to identity

The identity data type is a unique id that can be used to identify a row in a table. The primary use for the identity data type is for maintaining the primary key in a table. Unfortunatly I am not that familiar with PL/SQL, so I can't explain how to write it.

Good Luck

Neal Martinelli

Collapse -

identity

by cedla In reply to identity

The question was auto-closed by TechRepublic

Collapse -

identity

by pVp In reply to identity

Identity is not a datatype, it's a property!

Which datatypes can be used with the identity property depends on which database server you're running. It's going to be a numeric type, but Sybase requires numeric(n,0); other products allow any number (int, float, etc.) or a subset of numeric types.

Collapse -

identity

by cedla In reply to identity

The question was auto-closed by TechRepublic

Collapse -

identity

by Glen_McLeod In reply to identity

In Oracle (I assume, because you mention PL/SQL), what you're describing is a Sequence, and yes, it is a property of the column. (Identity property is Sybase and MS SQL Server.) You'd have to check the Oracle documentation for the exact base type(s) allowed for the column, in SQL Server it's integer.

When you add a record to a table that has this type of column, you don't specify a value for the column because the DB engine takes care of it. If the increment is 1, then the value will be Max(column) + 1. If the increment is 10, then it'll be Max(column) + 10.

Glen

Collapse -

identity

by cedla In reply to identity

The question was auto-closed by TechRepublic

Collapse -

identity

by cedla In reply to identity

This question was auto closed due to inactivity

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums