Solved

Insert data in rowid datatype column?

Posted on 2004-08-02
7
1,266 Views
Last Modified: 2012-05-05

How can I insert data in an index organized table that has 2 columns of number and rowid datatypes.

Here is the ddl:

CREATE TABLE "CSS"."TESTTABLE"
("DOCID" NUMBER(38),
 "TEXTKEY" ROWID NOT NULL,
    CONSTRAINT "SYS_IOT_TOP_32819" PRIMARY KEY("TEXTKEY"))  
    ORGANIZATION
    INDEX  
    TABLESPACE "SHRD" PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE ( INITIAL 128K NEXT 0K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0)
    LOGGING

0
Comment
Question by:mohammadzahid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 15

Expert Comment

by:jdlambert1
ID: 11700095
If you're using Oracle, you can't insert into a rowid, that done automatically by Oracle. If you're not using Oracle, please tell us what you are using.

From "Oracle PL/SQL Programming":

In the Oracle RDBMS, ROWID is a pseudocolumn that is a part of every table you create. The rowid is an internally generated and maintained binary value which identifies a row of data in your table. It is called a pseudocolumn because a SQL statement includes it in places where you would normally use a column. However, it is not a column that you create for the table. Instead, the RDBMS generates the rowid for each row as it is inserted into the database. The information in the rowid provides the exact physical location of the row in the database. You cannot change the value of a rowid.

You can use the ROWID datatype to store rowids from the database in your pl/sql program. You can SELECT or FETCH the rowid for a row into a ROWID variable.
0
 
LVL 8

Expert Comment

by:annamalai77
ID: 11700812
hi there

what our friend has said earlier is correct. u cannot do anything like update or insert into a rowid column in oracle since it is being maintained internally by oracle,which is unique for everyrow in a table. but if the field is just a userdefined one then u can use the decault insert command to insert values into the table.

regards
annamalai
0
 
LVL 11

Author Comment

by:mohammadzahid
ID: 11700829
I know that rowid are maintained by Oracle internally and are exclusive to each row.

Can you please paste the exact command showing how to insert values into the table that has user defined rowid datatype.

Thanks.

0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 8

Expert Comment

by:annamalai77
ID: 11700846
hi

what do u mean by user defined rowid datatype

insert into css values(1,'aabb36156');

commit;

do u have any logic to generate the rowid by urserlf.

regards
annamalai
0
 
LVL 11

Author Comment

by:mohammadzahid
ID: 11701220
I meant was if I create a table and use rowid as datatype. Please see DDL of the table at the start of this thread.

I don't have a logic to generate the rowid myself.
All, I need to do is figer out a method to populate a table to test my database application against an index organized table that gets called from a C program that reads storage parametes of IOT.

The insert statement you pasted in your last response is not valid.


0
 
LVL 6

Expert Comment

by:hans_vd
ID: 11703495
insert into css
values(1,'AAAABB22FFFFCCCC');

But I really can't think of a reason to do this.  You probably need something like this:

insert into css
select 1, rowid from some_table
where rownum < 2;
0
 
LVL 15

Accepted Solution

by:
jdlambert1 earned 250 total points
ID: 11706734
Create your table without specifying a rowid column. Oracle will take care of it automatically. You can't create it, and you can't insert into it, and you can't make it a primary key.

You can use it, by selecting that column, assigning it to a variable, using logic in a stored procedure, whatever.

CREATE TABLE "CSS"."TESTTABLE"
("DOCID" NUMBER(38),
    CONSTRAINT "SYS_IOT_TOP_32819" PRIMARY KEY("DOCID"))  
    ORGANIZATION
    INDEX  
    TABLESPACE "SHRD" PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE ( INITIAL 128K NEXT 0K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0)
    LOGGING

When you insert into an Oracle table, ignore the fact that there is a hidden rowid column.
INSERT CSS.TestTable(DocID) VALUES(1)

SELECT rowid, docid FROM CSS.TestTable
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question