Home > database >  Determine whether there is a record, if any return zero does not exist returns 1
Determine whether there is a record, if any return zero does not exist returns 1

Time:09-22

Not to judge whether is null when the primary key is a value in the table to see if there is a record, returns 0, not return 1 for help you a great god

CodePudding user response:

It is good to use a decode:

Decode (count (pk), 0, 0)

CodePudding user response:

Select sign (count (*)) from user_tables where table_name='TEST'

CodePudding user response:

In case the when the where condition is not Null, no?

CodePudding user response:

Select the decode (count (pk), 0, 0) from the table where pk=?

CodePudding user response:

Is the primary key for a certain value, the means, actually have this record, only judge whether a field has a value,
If so, you can use the decode, also can use the NVL

CodePudding user response:

One is to obtain rows, one is to determine whether a record is empty, don't know what you choose,

CodePudding user response:

refer to the second floor wmxcn2000 response:
select sign (count (*)) from user_tables where table_name='TEST'

Learning the.. Haven't seen this function

CodePudding user response:

Don't understand this thing,
  • Related