I want to search a string called "Insert into dba.t_table" in all procedures on sql anywhere 12.0

Currently I am using

select proc_name, * from sysprocedure where source like '%INSERT INTO dba.t_table%'

which gives only 5 rows. But sometimes we write code such as

INSERT INTO
   dba.t_table

So there is a whole line space after INSERT INTO. So I am not sure if that will give accurate results or no. Then I tried below,

select proc_name, * from sysprocedure where source like '%dba.t_table%'

But this gives 95 rows. (too much)

Any other easy and accurate way to search this?

asked 01 Feb '13, 10:52

roadtrain64's gravatar image

roadtrain64
1366710
accept rate: 0%

edited 01 Feb '13, 14:09

Graeme%20Perrow's gravatar image

Graeme Perrow
9.6k379124


If you are concerned with identifying whitespace, you may use SIMILAR TO instead of LIKE, something like (the untested):

WHERE source SIMILAR TO '%INSERT INTO[[:whitespace:]]+dba.t_table%'

BTW: You should also make sure that the "preserve_source_format option" is set, otherwise the "source" column may be NULL. If it is not set, you can search within column "proc_defn", which will contain the code in possibly reformatted way.

permanent link

answered 01 Feb '13, 12:42

Volker%20Barth's gravatar image

Volker Barth
40.1k361549819
accept rate: 34%

edited 01 Feb '13, 12:46

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×22
×7
×5

question asked: 01 Feb '13, 10:52

question was seen: 2,321 times

last updated: 01 Feb '13, 14:09