Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2017
    Posts
    2

    Unanswered: ROWID data while inserting into Temp Table

    Hi All,
    I am trying to insert Rowid values into temp table using below query.

    Insert into t1(ID,Name)
    select rowid as id, Name from emp

    Insertion works well but when I am doing Select * from t1, It is showing Junk in Id column of t1 table.

    Please advise.


    Thanks,
    Sam

  2. #2
    Join Date
    Oct 2007
    Posts
    162
    Provided Answers: 9
    how about a little more info? What is your table definition? What do you mean by junk? and What are you expecting to have?

  3. #3
    Join Date
    Sep 2017
    Posts
    2
    Quote Originally Posted by DNance View Post
    how about a little more info? What is your table definition? What do you mean by junk? and What are you expecting to have?

    Table Structure - t1(ID char(40),Name varchar(50) )


    Insertion works well but when I am doing Select * from t1, It is showing Junk in Id column of t1 table.

    I am able to see ROWID values properly, when I am running only select statement but when I am trying to add same data into into table t1.
    I am getting Junk Charater in ID column of table t1 like Square,Arrows etc.

    Please advise.



    Thanks,
    Samadhan

  4. #4
    Join Date
    Jul 2016
    Location
    Moscow
    Posts
    306
    Provided Answers: 46
    Hi,

    rowid == rid_bit(...)
    It returns 'varchar(16) for bit data' data type, and not 'varchar(40)'

    If you want to get "readable" representation of such a value, you can use hex function:
    Code:
    select hex(rowid) as row_id, hex(rid_bit(e)) as row_id_the_same, Name from emp e;
    Regards,
    Mark.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •