Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL scripts

Status
Not open for further replies.

teknikalbody

Programmer
Mar 2, 2003
35
GB
Hi

I have got around 53 SQL statments similar to:

SELECT * FROM 'VARIOUS_TABLE' WHERE 'CHANGING_COLUMN_NAME' = 'CONSISTANT_VALUE'

I NEED TO EXECUTE THESE TO SEE IF THEY BRING BACK ANYTHING DISREGARDING ANY THAT DONT.

I'M JUST WONDERING IF THERE IS A FAST AND EFFICIENT WAY TO THIS.


TIA
 
You can execute the SELECT statement and check the row count SQL%ROWCOUNT

SELECT * FROM....ETC...

IF ( SQL%ROWCOUNT <> 0 ) THEN

***Do What you like***

END IF;

Repeat this process.


Or you should be able to use a LOOP structure if you want to save on logic. You could store the Table and Column Name in a Record. Then repeat the LOOP structure until you have completed all the Records.
 
Wellster, How would execute the sql statements from within a loop. Thankyou.
 
Hi, I have been working mostly with SQL server, but now will be working this Oracle. I was wondering if someone can teel me waht VB6 Connection strings and select statements would look like for Oracle. For example how would I do the following in Oracle. Thank You

Public adoConnect As ADODB.Connection
Public adoRecordset As ADODB.Recordset

Set adoConnect = New ADODB.Connection
adoConnect.ConnectionString = "Provider=SQLOLEDB;Data Source=;Initial Catalog=Sales;Integrated Security=SSPI;Persist Security Info=False;"

Set adoRecordset = New Recordset
adoRecordset.Open "Select * from Orders", _
adoConnect, adOpenStatic, adLockOptimistic


Set txtID.DataSource = adoRecordset
txtID.DataField = "cust_ID"


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top