Gowtham Ramamoorthy
asked on
IS it possible to declare a array variable inside a stored procedure of SQL ?
I tried with the below code but its throwing an error.
DECLARE TYPE INPUTVALUES IS VARRAY(5) OF VARCHAR2(10);
DECLARE TYPE INPUTVALUES IS VARRAY(5) OF VARCHAR2(10);
you can try declare it as a Table:
declare @arr table(v VARCHAR(10))
insert into @arr(v) values ('2421')
insert into @arr(v) values ('1531')
insert into @arr(v) values ('7721')
insert into @arr(v) values ('9421')
insert into @arr(v) values ('1051')
select * from @arr
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@Gowtham Ramamoorthy, glad that you found the solution cheers
ASKER
Thanks Ryan. But actually I have just started to code a procedure. I dont know how deep the rabbit hole goes. Need your help for sure.
@Gowtham Ramamoorthy, I just want to highlight one thing...
It seems you're quite new to this site, but what I mean is that my suggestion is same as what Vikas Garg had proposed, is there any reason why you accepted his suggestion but not give a same fair grade to my suggestion as well? it seems that both of us posted within an interval of 1 min but my suggested was posted first.
It seems you're quite new to this site, but what I mean is that my suggestion is same as what Vikas Garg had proposed, is there any reason why you accepted his suggestion but not give a same fair grade to my suggestion as well? it seems that both of us posted within an interval of 1 min but my suggested was posted first.
VARCHAR2 is an Oracle data type (not avaliable in mssql) but you have chosen 3 MSSQL topics
Oh. and if anything throws an error please include the FULL text of that error (error code and any explanation)