There’s an interesting “debate” going on under AskTom at the moment. It’s hardly cause for major concern, but anyone is welcome to add their thoughts as comments to this blog post. (Naturally, if your comments agree with my opinion, then that’s great. If your comments don’t agree, then I’ll post them and ignore them
– ah the joys of being a blog owner)
So here’s the issue. When we are posting code to the AskTom page as a solution to a question, we could post it as a mix of script and output, for example:
drop table T purge;
create table T ( x int );
insert into T select level from dual connect by level <= 10;
select * from T;
X
----------
1
2
3
4
5
6
7
8
9
10
Or, we could post the code exactly as it would have appeared to us as we ran it in (say) SQL Plus.
SQL> drop table T purge;
Table dropped.
SQL> create table T ( x int );
Table created.
SQL> insert into T select level from dual connect by level <= 10;
10 rows created.
SQL> select * from T;
X
----------
1
2
3
4
5
6
7
8
9
10
10 rows selected.
My personal preference is the latter, since it’s a no “smoke and mirrors” approach. A common feedback is that you cannot cut-and-paste the second example and just run it in your session. My counter-argument to that is that its pretty easy to clean it up. For example, in any editor that supports regular expressions, you just do:
Change ^….. to nothing.
ie, remove the first 5 characters at the start of each line, and you’re almost there.
In reality, either option is perfectly adequate (but you’d be amazed how “passionate” some of the feedback we get is!)
So let me know what your preference is – if you make the correct choice, I’ll agree with you ![]()




Leave a reply to John Cancel reply