How do I see the data of the execution immediate o/p

Hello

I tried the following code
SQL> declare
  2  vSql varchar2(3000);
  3  begin 
  4  vSql:='SELECT';
  5   for i in (select column_name from user_tab_columns where table_name='EMP' order by column_name
) 
  6   loop
  7     vSql:=vSql||i.column_name||',';
  8   end loop; 
  9   execute immediate rtrim(vSql)||' '||'from emp'; 
 10  end;
 11  /
declare
*
ERROR at line 1:
ORA-00900: invalid SQL statement
ORA-06512: at line 9
Please guide me to solve this error

Published by: josh1612 on June 22, 2010 03:58

I could see some errors in your sql script.

4  vSql:='SELECT';

to be

4  vSql:='SELECT ';

9   execute immediate rtrim(vSql)||' '||'from emp'; 

to be

9   execute immediate rtrim(vSql,',')||' '||'from emp'; 

But if you get the error next time, before run you the output the variable using the dbms_output and try to run the sqlplus output text.

I hope this helps.

Thanks for the post of formatting.

Concerning

REDA

PS: It's not tested.

Published by: R.Subramanian on June 22, 2010 03:14

Tags: Database

Similar Questions

  • How can I see the list of authorized computers (not how)?

    Hello

    I would need to see the list of computers that are allowed before removing all permissions.

    How can I see the list of the authorized computers (not how I have)?

    Thank you

    There is not one available from your end.

    (144073)

  • Why, in the address bar in the url no but "go to website"? How can I see the url in the address bar?

    Why the address bar is not URL, but the "go on the web site? How can I see the URL in the address bar?

    Here's a few addons that other users have reported to cause the same problem in the past: Gom player, Ask Toolbar, DivX Web Player, RealPlayer Plugin browser Record (more)...

    in case you have one of them is present, try to disable/remove it - otherwise you could disable all extensions of your & re-enable each (a browser restart may be required after each step) until find you the culprit.

  • How can I see the full target URL when I hover over a link? Not a short URL.

    How can I see the full target URL when I hover over a link? I don't want to see short URL. Is there a way to customize this?

    Full target URL allowing me to easily see how visitors reached my site via Google, Bing, Yahoo Research, etc. With the short URL I don't see what they entered into the search field.

    You can use this extension to restore the characteristics of loss of status bar and customize settings such as displaying the URL of a link to the overview.

  • How can I see the total number of bookmarks I have?

    I think I have about 300 a few bookmarks, but I'm not sure. How can I see the exact number? (e.g. bookmarks 311 total)

    You can go to the bookmark (library) Manager and open the folder all bookmarks and type only a common character like a '. 'or a':' in the search box.

    If you select all bookmarks with "Cmdl + A" in the right pane, and then you see total under this component.

  • How can I see the amount of cycles of battery on the Satellite U200-181?

    I have Satellite U200-181, and I use it hard, each. I want to be ready replace my battery, when he has 400 cycles.
    How can I see the amount of cycles of battery on my laptop?

    You shouldn't see this. You will see that the battery capacity goes down and will be empty shortly after. No one says that you will be able to use the 400 battery cycles only. You may be lucky and the battery will be more long service life.

    My Tecra M1 is about 4 years old and still works with the original battery.

    Your question is quite unusual and I am really interested about new comments.

  • How can I see the month Apple Watch next?

    How can I see the month Apple Watch next?

    Hello

    The application of calendar on Apple Watch currently showing events you have planned or have been invited in for today and next week.

    You can also see the days of the current month (but not beyond) as a month view. To see this:

    -By events for any day display, type on the < symbol in the upper left corner of the screen.

    -Press on the month to return to the day view calendar.

    If you want to suggest that Apple considers allowing the calendar to display events for additional periods, you can do it here:

    https://www.Apple.com/feedback/watch.html

  • How can I see the gifts exchanged in itunes history

    How can I see the gifts exchanged in itunes history

    Pete,

    Sorry, can't do it.  You can view a history of purchases, but not redemption.

  • How can I see the photos that are not in an album?

    How can I see the photos that aren't in an album in the App "Photos"? I noticed that in the Album 'Pictures' are pictures I thought I deleted already. I would like to see all the photos in an album, so I can finally delete them.

    You can go the the file menu Photos and click New Smart Album, and then set the condition of Album - is not. This will create a smart album that will show you all the photos that are not in any other album.

  • How do I see the full example vi

    Hello

    I just want to know how can I see the full example VI.

    for example, I opened a void VI and in the diagram Panel I right click and see the 'Functions' tab from which I select 'Arduino' and then I choose 'examples', then 'examples of servo.

    It gives me just a block away. How can I see the whole VI of a block?

    Thank you

    When you double-click the block you get the front panel

    in this façade, go to 'Window' and then select 'display the diagrm block '.

  • My use of the disc skipped dramatically. How can I see the use of the disc by folder or subfolder to see what happened?

    My use of the disc skipped dramatically.  How can I see the use of the disc by folder or subfolder to see what happened?

    Probably - system restore
    System Restore: frequently asked questions
    http://windowshelp.Microsoft.com/Windows/en-us/help/517d3b8e-3379-46C1-B479-05b30d6fb3f01033.mspx
    TaurArian [MVP] 2005-2010 - Update Services

  • I can't display image icons when working with my photo folder. How can I see the photos without having to click on them in preview mode?

    I can't display image icons when working with my photo folder. How can I see the photos without having to click on them in preview mode?

    -It used to work and for some reason, now it does not work

    Greetings, d_chiuch1104,

    There is one thing that I know that you need to check that COULD be your problem.  Open Control Panel (in Classic view) and click Folder Options (or, in Control Panel, click on appearance and personalization and then Folder Options).

    Open the view tab and make sure that "Always show icons, never thumbnails" is NOT checked.

    It would be good to hear from you as to whether that was the problem!

    GL - Bob

  • How can I see the cluster move in Disk Defragmenter, when I run the program

    How can I see the clusters move in Disk Defragmenter when I run on my old computer I could see and my step dad had told me that anyone who has a computer can display when they run this program

    Due to popular demand, is no longer a part of Disk Defrag in Vista.

    Disk Defrag in Visa works quietly in the background.

    People complained the old Disk Defrag in XP style interface, as they had to do on her computer, not to watch the little squares moving.

    You can use 3rd party defragmentation products:

    http://www.SnapFiles.com/reviews/Auslogics-Disk-Defrag/adiskdefrag.html

    http://www.SnapFiles.com/reviews/IObit-SmartDefrag/iobitsmartdefrag.html

    http://www.SnapFiles.com/reviews/Diskeeper_Home/Diskeeper.html

    See you soon.

    Mick Murphy - Microsoft partner

  • How can I see the list of programs that are allowed through the firewall?

    How can I see the list of programs that are allowed through the firewall?  I can't find the list.

    Open Windows Firewall and select 'allow a program or feature through Windows Firewall. You can then view or modify programs all allowed.

    Jim

  • How can I see the plan of execution/explain Prev

    Hi Master,

    Y'day my application works very well. But today query times. I want to see the execution plan of y'day to compare the current execution plan. How can I see? Where it will store?

    Please advise... !!

    Concerning

    AR

    Hi 874273, here's a way, using DBA_HIST_SQL_PROFILE: (http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_3179.htm#REFRN23443)

    SELECT p.id,
           RPAD(' ', p.depth)||p.operation||' '||p.options operation,
           p.object_name name,
           ROUND(p.bytes/1024, 0) kbytes,
           p.cpu_cost, p.io_cost,
           p.temp_space,
           p.cardinality, p.cost,
           TO_CHAR(TRUNC(p.time/3600),'FM9900')||':'||
           TO_CHAR(TRUNC(MOD(p.time,3600)/60),'FM00')||':'||
           TO_CHAR(MOD(p.time,60),'FM00') time,
           p.timestamp
    FROM   dba_hist_sql_plan p
    WHERE  p.sql_id = '99a6nwhm3hjju'
    ORDER BY p.plan_hash_value, p.id
    

    You should know the sql_id (available from v$ sql, v$ sqlares. dba_hist_sqltext...)

    See you soon,.

    The Canada Gazette

  • How can I see the plan private enforcement.

    Hi Master,

    Y'day my application works very well. But today query times. I want to see the execution plan of y'day to compare the current execution plan. How can I get? Where it will store?

    Please advise... !!

    Concerning

    AR

    You can query V$ SQL table get, get the SQL_ID of your query.

    Let's say you're SQL_ID = 30h4bvv184064

    then pass it to sql: select * from table (DBMS_XPLAN. DISPLAY_cursor ('30h4bvv184064'));

Maybe you are looking for