Toad World® Forums

How to return multiple results from an variable cursor [3 Attachments]


#1

How to return multiple results from an variable cursor [3 Attachments]


#2

[Attachment(s) from Dunbar, Norman (Capgemini) included below]

Hi Edwin,

hopefully, the attachments will get through. Have fun.

Cheers,
Norm. [TeamT]

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk

Attachment(s) from Dunbar, Norman (Capgemini):

3 of 3 File(s) http://groups.yahoo.com/group/TOADSQL/attachments/folder/701778426/item/list
testNormUtility.txt
NORMUTILITY.pks
NORMUTILITY.pkb


#3

I forgot to mention:

in NormUtility.pks you need to set the constant gColumnName to the upper
case column name that you wish to query - IGI_SLS_SEC_GROUP perhaps?

Also, in the same file, in the t$TransferRecord the column_data field
has been defined as VARCHAR2(100) - this is a guess. If ALL your tables
have the column (IGI_SLS_SEC_GROUP) defined as VARCHAR2(10) then you can
set the definition to that OR, better, to this:

column_data your_table_name.IGI_SLS_SEC_GROUP%type

Where is ONE of your tables that contains the column
IGI_SLS_SEC_GROUP. That way, if you ever redefine the column to be
VARCHAR2(20) then all you have to do is recompile the package and body.

To run it:

SELECT * FROM TABLE(NormUtility.CountRowsInColumn);

The output is a table of t$TransferRecord so you can query as follows:

SELECT * FROM TABLE(NormUtility.CountRowsInColumn)
WHERE record_count > 5;

or

SELECT table_name, column_data, record_count
FROM TABLE(NormUtility.CountRowsInColumn);

Etc.

Cheers,
Norm. [TeamT]

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk