search entire oracle database for part of string

前端 未结 2 1019
孤城傲影
孤城傲影 2021-01-27 12:07

I\'m trying to find a specific string in an entire Oracle database.

I\'ve followed the example in another topic on here (Search All Fields In All Tables For A Specific

2条回答
  •  甜味超标
    2021-01-27 12:23

    You can concatenate the bind variable with the wildcard % characters:

    EXECUTE IMMEDIATE
      'SELECT COUNT(*) FROM ' || t.owner || '.' || t.table_name ||
      ' WHERE '||t.column_name||' LIKE ''%'' || :1 || ''%'''
      INTO match_count
      USING 'ALERT';
    

    Note that the single quotes have to be escaped by doubling them up.

提交回复
热议问题