Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    149

    Thumbs down Unanswered: delete with join

    Hello,

    I want to delete some records from mytable. But to check which records i want to delete i have to join with dba_tab_columns. but something like this:

    delete from
    (select *
    from mytable myt
    join dba_tab_columns col on myt.tablename = col.TABLE_NAME)
    where myt.type = 1;

    is not possible. I have not the right to delete from dba_tab_columns. This is logical. With a cursor it works alright. Does anyone know how i can make one delete-statement to delete the records from mytable?

    greetings Coen Dunnink
    The Netherlands

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    Looks like you are just checking to see if the table exists in your database/schema.
    Does that sound right? (I have no idea why you want to check if it is in the db)

    PHP Code:
    delete from table_a a
      where a
    .type 1
        
    and exists 
          
    (select 1 from dba_tab_columns where table_name 'TABLE_A'); 
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    149

    Exclamation solution or no solution?

    I don't know why you want to know why i join dba_tab_columns. But if you REALLY want to know: mytable is in reallife i table with metadata of our other tables. We keep notice of length of the fields, inputtypes, ordering of columns in our screens, etc. etc.. This is all herritage of oldschool database like REMA. but this all does not matter. it is just like this. i have to live with it. So do you know a solution?

    greetings
    Coen Dunnink
    The Netherlands

  4. #4
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    He gave you a solution ...
    ps... Welcome back Duck...

  5. #5
    Join Date
    Jul 2003
    Posts
    2,296
    Quote Originally Posted by gbrabham
    He gave you a solution ...
    ps... Welcome back Duck...
    Thanks. My company ran out of money so I have been looking for a new position
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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