Search Results

Search found 1 results on 1 pages for 'user1905941'.

Page 1/1 | 1 

  • simple query Delete records in a table based on count logic

    - by user1905941
    a table with a pk and status column which is having values as 'Y','N','NULL' Query: get the count of records with status column as 'Y', if this count exceeds 1% of total count of records then dont delete , else delete the records in the table. i tried like this Declare v_count Number; v_count1 Number; BEGIN v_count := select count(*) from temp; v_count1 := select count(*) from temp where status = 'Y' ; v_count := v_count + ((0.1) * (v_count)) if (v_count1 > v_count) { insert into temp1 values(pk,status) } else { Delete from temp ; } END;

    Read the article

1