Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
neerajdba
Starting Member
2 Posts |
Posted - 2011-11-17 : 06:03:42
|
Hi,I have use this code to declare collection indexDECLARE @CollectionIndexInt$TYPE varchar(max) = ' TABLE OF ( RECORD ( UCID DECIMAL , C_TIME DATETIME , KEY DECIMAL , KEY_SET DECIMAL , VALUE DECIMAL ) )', @CollectionIndexInt$TYPE$2 varchar(max) = ' TABLE OF ( RECORD ( KEY_SET DECIMAL , VALUE DECIMAL ) )' DECLARE @main_sets_item dbo.CollectionIndexInt = dbo.CollectionIndexInt ::[Null].SetType(@CollectionIndexInt$TYPE), @main_item dbo.CollectionIndexInt = dbo.CollectionIndexInt ::[Null].SetType(@CollectionIndexInt$TYPE$3), Now I want to use this like FETCH @c_sysref INTO @ucid, @c_time, @key, @key_set, @value IF @@FETCH_STATUS = -1 BREAK SET @main_sets_item = @main_sets_item.ExtendAndSetRecord(@collection_cur_key, @main_sets_item.GetOrCreateRecord(@collection_cur_key).SetDecimal(N'VALUE', @value)) SET @main_sets_item = @main_sets_item.ExtendAndSetRecord(@collection_cur_key, @main_sets_item.GetOrCreateRecord(@collection_cur_key).SetDecimal(N'KEY_SET', @key_set)) SET @main_sets_item = @main_sets_item.ExtendAndSetRecord(@collection_cur_key, @main_sets_item.GetOrCreateRecord(@collection_cur_key).SetDecimal(N'KEY', @key)) SET @main_sets_item = @main_sets_item.ExtendAndSetRecord(@collection_cur_key, @main_sets_item.GetOrCreateRecord(@collection_cur_key).SetDatetime(N'C_TIME', @c_time)) SET @main_sets_item = @main_sets_item.ExtendAndSetRecord(@collection_cur_key, @main_sets_item.GetOrCreateRecord(@collection_cur_key).SetDecimal(N'UCID', @ucid))DECLARE @key_set$2 float(53) SELECT @key_set$2 = sysdb.ssma_oracle.db_get_next_sequence_value(N'Tific', N'DEV_LOG', N'LOG_SAC_SETS_SEQ') SET @main_sets_item = @main_sets_item.SetRecord(@i, @main_sets_item.GetOrCreateRecord(@i).SetDecimal(N'KEY_SET', @key_set$2)) SET @main_item = @main_item.Extend() SET @main_item = @main_item.SetRecord(@main_item.Last(), @main_item.GetOrCreateRecord(@main_item.Last()).SetDecimal(N'UCID', @main_sets_item.GetRecord(@i).GetDecimal(N'UCID'))) SET @main_item = @main_item.SetRecord(@main_item.Last(), @main_item.GetOrCreateRecord(@main_item.Last()).SetDatetime(N'C_TIME', @main_sets_item.GetRecord(@i).GetDatetime(N'C_TIME'))) SET @main_item = @main_item.SetRecord(@main_item.Last(), @main_item.GetOrCreateRecord(@main_item.Last()).SetDecimal(N'KEY', @main_sets_item.GetRecord(@i).GetDecimal(N'KEY'))) SET @main_item = @main_item.SetRecord(@main_item.Last(), @main_item.GetOrCreateRecord(@main_item.Last()).SetDecimal(N'KEY_SET', @main_sets_item.GetRecord(@i).GetDecimal(N'KEY_SET')))But when i use this likeWHILE @ii <= @main_item.COUNTINSERT INTO log_sac_main VALUES @main_item.GetRecord(@ii)This gives Error,Please help me on this- Neeraj |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-11-17 : 12:21:40
|
I've never used SSMA, so I don't have the exact answer, but...What's the error?Saw this article? |
|
|
neerajdba
Starting Member
2 Posts |
Posted - 2011-11-18 : 01:22:26
|
Thanks russell to prompt reply. Ok forget SSMA, if i use Collections via CLR UDT then i am not able to use this. actually i am not able to use @main_item var to insert statement. when i use like thisINSERT INTO log_sac_main VALUES @main_item.GetRecord(@ii)this gives error 'incorrect syntax error'. My problem is how i use @main_item var for insert record.Thanks |
|
|
johntech
Yak Posting Veteran
51 Posts |
|
|
|
|
|
|