If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > How to define a table name thru a variable

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-03, 18:16
murphyld murphyld is offline
Registered User
 
Join Date: Jan 2003
Posts: 2
Question How to define a table name thru a variable

Hello,

I am writing an ASP script to retrieve stock data and store it Oracle. I have been able to successfully retrieve the data and store it in one table. Now I would like to segregate the data in to multiple tables whos names are defined by the variable that holds the stock symbol.

I am using Oracle 8.1.7, Microsoft OLE DB, Win2K IIS and XP Pro.

Sincere thanks in advance for any help guidance.
Murphy

Here is script I have been working with:
==========================================
Function OracleWrite(TickerID, LastTrade, TradeDate, TradeTime, Change, OpenPrice, DayHigh, DayLow, Volume)

' connection and recordset variables
Dim Cnxn, strCnxn
Dim rsStocks, strSQLStockDat
Dim fld, Err


' open connection
Set Cnxn = Server.CreateObject("ADODB.Connection")

strCnxn = "Provider=msdaora;" & _
"Data Source=odat;" & _
"User Id=ouser;" & _
"Password=opass"

Cnxn.Open strCnxn

' create and open Recordset using object refs
Set rsStocks = Server.CreateObject("ADODB.Recordset")

rsStocks.ActiveConnection = Cnxn
rsStocks.CursorLocation = adUseClient
rsStocks.CursorType = adOpenKeyset
rsStocks.LockType = adLockOptimistic
rsStocks.Source = TickerID
rsStocks.Open

rsStocks.AddNew
rsStocks("TickerID") = CStr(TickerID)
rsStocks("LastTrade") = CDbl(LastTrade)
rsStocks("TradeDate") = CStr(TradeDate)
rsStocks("TradeTime") = CStr(TradeTime)
rsStocks("Change") = CDbl(Change)
rsStocks("OpenPrice") = CDbl(OpenPrice)
rsStocks("DayHigh") = CDbl(DayHigh)
rsStocks("DayLow") = CDbl(DayLow)
rsStocks("Volume") = CDbl(Volume)
rsStocks.Update
' check for errors
If Cnxn.Errors.Count > 0 Then
For Each Err In Cnxn.Errors
Response.Write("Error " & Err.SQLState & ": " & _
Err.Description & " | " & Err.NativeError)
Next
Cnxn.Errors.Clear
rsStocks.CancelUpdate
End If
'On Error GoTo 0
rsStocks.MoveFirst

Set Cnxn = Nothing
Set rsStocks = Nothing
End Function
Reply With Quote
  #2 (permalink)  
Old 02-02-03, 07:14
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: How to define a table name thru a variable

I have read this post a few times, but still can't understand what the question is. However, what jumps out at me is the phrase:

Quote:
Originally posted by murphyld
Now I would like to segregate the data in to multiple tables whos names are defined by the variable that holds the stock symbol.
Now that just sounds like a BAD idea! Why would you want a table per stock symbol? Sounds like a waste of effort to me.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On