Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> ?retrive sql text from a stored proc
hi
I am doing some consulting work for an k12 institution. The
provincial
edu department has a oracle db that is queryed buy this division via a
excel ss given to them buy the provincial edu. In the ss a sp is run
to retrive data
for one grade we were hoping to customize the query a bit to get more
demographics on all grades. can i get the text of a query that is run
thusly:
sqlStr = "dbo.up_s_batch_stats_EXCEL " & Val(Range("G8").Value)
ie get the SELECT .... FROM... that is run by dbo.up_s_batch_stats_EXCEL
Sub batchStats()
On Error GoTo eh
'If Format(Time, "HH:MM") >= Format("08:00", "HH:MM") And Format(Time,
"HH:MM") <= Format("17:00", "HH:MM") Then
' MsgBox "This query can only be run before 8 AM or after 5 PM" ' Exit Sub 'End If
Range("A2").Select
Dim sqlStr As String
sqlStr = "dbo.up_s_batch_stats_EXCEL " & Val(Range("G8").Value)
With Selection.QueryTable
.Connection = _
"ODBC;DRIVER=SQL Server;SERVER=LTDBPRDCL;APP=Microsoft®
Query;DATABASE=cnv_ttl_prd;Trusted_Connection=Yes"
.Sql = sqlStr
.Refresh False
End With
MsgBox "Data refreshed!"
Exit Sub
eh:
If Err.Number = 1004 Then
MsgBox "This query can only be run before 8 AM or after 5 PM" Else
MsgBox Err.Number & " " & Err.Description
End If
End Sub
Received on Sat May 04 2002 - 00:59:46 CDT
![]() |
![]() |