plsql - Can anyone tell me what is wrong with the following PL/SQL block? -


i trying execute following script in sqlplus each time says "missing keyword". main objective select random number column1 of table variable vnm_rand_number each value(1 8) of column2. please tell me wrong code , there other way me this?

declare   vvc_sql_stmt    long; vvc_name   varchar2(10) := 'asdf'; vnm_rand_number number; vvc_table_name  varchar2(50);  begin  vvc_table_name := 'ak_'||vvc_name||'';  in 1 .. 8 loop  vvc_sql_stmt := 'select column1 vnm_rand_number from( select * '||vvc_table_name||' column2 = '||i||' order dbms_random.value)  rownum = 1';  execute immediate (vvc_sql_stmt);  commit;  dbms_output.put_line(vnm_rand_number);  end loop; end; / 

it's helpful post full error stack (the ora-xxxxx error number, line throwing error, etc.). guess want

vvc_sql_stmt :=    'select column1 ' ||   ' from( ' ||   '      select * ' ||   '        ' || vvc_table_name ||   '       column2 = :1 ' ||    '       order dbms_random.value) ' ||   ' rownum = 1';  execute immediate vvc_sql_stmt     vnm_rand_number    using i; 

of course, it's idea when you're using dynamic sql log statement you're execute somewhere before execute can see got constructed. makes debugging easier.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -