Hi,
I am craete a web based application in ASP.Net using C#, I want to use for loop in Oracle create statment on button click event,
The original for loop is as below which I need to use in create statment,
for (int jl = 0; jl <= ListBox_Area.Items.Count - 1; jl++)
{
if (ListBox_Area.Items[jl].Selected)
{
Disp_Job_Area.Text += "'" + ListBox_Area.Items[jl].Text + "'" + " , ";
}
}
I tried to use above loop in create statment but unable to do it,
OleDbCommand myCommand = newOleDbCommand();
myCommand.Connection = con;
myCommand.CommandText = "CREATE TABLE CSU_AREAS_TRANSPOSED as select * from (select CONTACT_ID, for loopDECLARE jl NUMBER := 0 BEGIN FOR k '"+ListBox_Area.Items.Count - 1+"'.. jl++ LOOP max( decode( JOB_AREA, '"+ListBox_Area.Items[jl].Text+"', 1 , 0 ) ) AS column_Name_1 END LOOP FROM(SELECT CONTACT_ID, JOB_AREA FROM Table_Name) group by CONTACT_ID where '"+ListBox_Area.Items[jl].Text+"'> 0)
myCommand.ExecuteNonQuery();
LblCheck.Text = "Table Created Successfully";
I am not sure if it is fisible to create a table using for loop or not, I am looking for creating a table based on selected values from list box and these selected values are becoming column names for new table at the same time these selected values will get the the data from other table and insert into respective columns of newly created table.
Can anyone please help me with this.
Thanks in advance.
Regards,
Abhishek