• (cs) in reply to kipthegreat

    I've actually used Photoshop to generate code before (and I don't mean with the listener plugin, though I've done that, too). For what it's worth, this was for image processing, so it's not quite as weird as it seems.

  • (cs)
    Alex Papadimoulis:
    begin
    if 'DATE' = 'NUMBER' and length('DATE')>0 and length('')>0 then execute immediate 'alter table "SCOTT"."EMP" add(FIREDATE DATE(, ))';
    elsif 'DATE' = 'INTEGER' or ('DATE' = 'NUMBER' and length('DATE')>0 and length(<font style="font-weight: bold; color: rgb(255, 0, 0);">''</font>)=0) or 'DATE' = 'VARCHAR2' then execute immediate 'alter table "SCOTT"."EMP" add(FIREDATE DATE())';
    else
    execute immediate 'alter table "SCOTT"."EMP" add(FIREDATE DATE)';
    end if;
    end;


    ammoQ:


    No, since in Oracle lenght('') is null.




    Just for the record, the lengh(whatever)=0 check is never true in PL/SQL. The whole idea with those templates is questionable, and this template is definitely broken.
  • tdog (unregistered)

    I hate Oracle and everything it stands for.  If you like Oracle, then I'm sorry, but you have an illness.  If you are forced to use Oracle because your management doesn't know better, then I'm also sorry. 

    tdog

  • XMLord (unregistered)
    Alex Papadimoulis:

    Every now and then, someone sends me some code that was outputted from some code generation tool. Sure, it's bad, but what can you expect? I mean, I'm not an anti-robotian or anything, but c'mon, machines generating code?



    Give me a break... The only wtf here is this post.
    So if one code generation tool is bad, all code generation is bad? Why don't you just say that all programmers are bad? There certainly seems to be an abundance of examples to support that theory, based on the same logic.

    This code is bad, because whoever wrote the code generation mixed checks that could have been done at "generation time" and checks that could have been done at runtime. That's actually a very common error. It tells me nothing about how good/bad a programmer whoever wrote the tool is.

  • (cs) in reply to ammoQ
    ammoQ:
    Digitalbath:

    Fixed:

    <FONT size=+0>begin
    if</FONT> false;
    <FONT size=+0>else
    execute immediate</FONT> <FONT size=+0>'alter table "SCOTT"."EMP" add(FIREDATE DATE)'</FONT>;
    <FONT size=+0>end if</FONT>;
    <FONT size=+0>end</FONT>;


    Doesn't work, since you cannot have empty branches in PL/SQL (but you can use a null statement to fill it) and if requires a then.
    Here is what it's meant to be:

    <FONT size=+0>begin
    if</FONT> false then null;
    <FONT size=+0>else
    execute immediate</FONT> <FONT size=+0>'alter table "SCOTT"."EMP" add(FIREDATE DATE)'</FONT>;
    <FONT size=+0>end if</FONT>;
    <FONT size=+0>end</FONT>;


    Right on.  I have never written anything in PL/SQL; I was just attempting to make a bad joke...

  • snow (unregistered) in reply to tdog

    we have a whole damn hospital of 3000 people running on an enterprise oracle database.  remote hosted in another state.  accessible via citrix.  over two T1 lines.  integrated with onsite stand-alone oracle databases (supplied by seperate vendors) via HL7 interfaces.  at my last count, we had 8 seperate oracle databases at our hospital.  =(

  • (cs) in reply to David Tremain

    Anonymous:
    Remember, there is no "reusability", "maintainability", "readability" or even "understandability" criteria for generated code. The only criteria for generated code is: Does it perform its intended task correctly? This appears to do that, even though it is really, really ugly.

    I would amend that with a second criteria:  Does it perform its intended task efficiently?

    This example certainly does not meet that.

  • (cs) in reply to Pineconius
    Pineconius:

    Anonymous:
    Remember, there is no "reusability", "maintainability", "readability" or even "understandability" criteria for generated code. The only criteria for generated code is: Does it perform its intended task correctly? This appears to do that, even though it is really, really ugly.

    I would amend that with a second criteria:  Does it perform its intended task efficiently?

    This example certainly does not meet that.



    This template does not even perform its intended task correctly. It works for DATE, but it breaks e.g. for NUMBER(5);
    the
    <font>and</font> length(<font>'DATE'</font>)>0 <font>and</font> length(<font>''</font>)=0)

    part is obviously wrong in several ways. There is no need to check the lenght of the name of the datatype (in this place there probably should have been the value of the next field) and a length(whatever)=0 check always fails.

  • Dude (unregistered)

    What is this code being generated for? If it's for users to modify and put into their programs/scripts, then the tool should make a bigger effort. If it's meant to be run and thrown away, or regenerated each time it's needed, then there really is nothing to be gained from having the tool generate "pretty" code, or maybe even efficient code. For all you know, the compiler/interpreter that receives the code might even do static analysis that reveals that some branches are unreachable, and not produce code for them. I've myself written a fair amount of code generation code, and if I have to choose between producing "pretty" code that a human might have written, and "ugly" code that has an invariant that simplifies the task, it's always the latter.

  • (cs) in reply to Dude
    Anonymous:
    What is this code being generated for? If it's for users to modify and put into their programs/scripts, then the tool should make a bigger effort. If it's meant to be run and thrown away, or regenerated each time it's needed, then there really is nothing to be gained from having the tool generate "pretty" code, or maybe even efficient code. For all you know, the compiler/interpreter that receives the code might even do static analysis that reveals that some branches are unreachable, and not produce code for them. I've myself written a fair amount of code generation code, and if I have to choose between producing "pretty" code that a human might have written, and "ugly" code that has an invariant that simplifies the task, it's always the latter.


    If a database tool lets you add a column to a table (a fairly simple task, I may add), it should do it correctly. This tool doesn't. (see above). If (and only if) this tools also offers you to show the SQL statement for that operation (this tool does, see the screenshots), it should rather make sure it doesn't look like a moron.
  • (cs) in reply to snow
    Anonymous:

    we have a whole damn hospital of 3000 people running on an enterprise oracle database.  remote hosted in another state.  accessible via citrix.  over two T1 lines.  integrated with onsite stand-alone oracle databases (supplied by seperate vendors) via HL7 interfaces.  at my last count, we had 8 seperate oracle databases at our hospital.  =(


    egad!
    I feel your pain.
  • FascistBaby (unregistered) in reply to kipthegreat
    kipthegreat:
    Speaking of generated code, has anyone else here ever used Microsoft Excel to generate code?
    ...
    Then just copy/paste the spreadsheet into notepad, s/\t//g, and copy/paste that right into your code.


    Are you mixing editors here? I can't imagine Notepad does sed. How do you search on a tab character? Or do you paste one into the dialog box from somewhere else?

    A different type of code generator you all might appreciate:

    World's 2nd and 3rd Simplest Code Generators
    http://secretgeek.net/w2scg.asp
    http://secretgeek.net/w3scg.asp
  • Steve Wahl (unregistered) in reply to kipthegreat
    Speaking of generated code, has anyone else here ever used Microsoft Excel to generate code?

    I do it occasionally, when I'll have a table of data that needs to be hard-coded into an array or something.  Just insert columns containing the needed spaces and punctuation, then fill down for all the data.  Then just copy/paste the spreadsheet into notepad, s/\t//g, and copy/paste that right into your code.  I've never seen anyone else do this, but I figure there must be others that have done this, since it makes a few specific tasks much faster and less error prone.

    So, you understand s/\t//g, but you find all that faster than the equivalent of
        1,$s/\([0-9]+\) +\([0-9]+\)/ { \1, \2 },/
    in your editor?  (OK, Maybe.  I admit it took a while to come up with that.  Not
    longer than it takes to start excel, but maybe you always have it running.)

    :-)

  • Eric (unregistered) in reply to ferrengi
    ferrengi:
    Disgruntled DBA:
    If you think this is bad, you should see what piles of steaming code come out of SQL Server's Enterprise Manager for the very same task.  And yes, SQL Server has the ability to add a column in one line.  Just no one ever told Enterprise Mangler.  The best part of the SQL Server generated code is it includes a drop table statement WITH NO ERROR CHECKING.  Have an error?  Too bad, I am dropping your one copy of the table, anyway.
    If all I need to do is add a column to a table, I'll simply right the one line alter table statement myself instead of having to use a tool to do it. Why bother with a tool SQLDeveloper or doing something in enterprise manager if it is not necessary?

    Some of that may be due to the fact that in SQL Server (at least in the 2000 version), views behave unpredictably (and usually incorrectly) when you change the underlying table.  I do my changes manually (so I can keep each change in SVN), but I make a habit of updating all views, functions, and stored procedures whenever I alter a table.
  • (cs) in reply to ammoQ

    PL/SQL is a dialect of Ada, so various Ada tools will work with it. I use Textpad with PL/SQL, Ada, and Oracle syntax files, and I'll probably switch over to Eclipse if they ever get the Oracle plugins to work right.

    SqlDeveloper has a much cleaner UI than TOAD or sqlNavigator or PL/SQL developer, so I use it as an object browser when I'd never touch the other 3.

    The competing products do at least as silly things as the code fragment (which will work, at least), but they are nowhere near as bad as the bottom feeder CASE tools. Try generating a schema from ERwin or qDesigner sometime...

  • (cs) in reply to RyuO
    RyuO:

    The competing products do at least as silly things as the code fragment (which will work, at least), but they are nowhere near as bad as the bottom feeder CASE tools. Try generating a schema from ERwin or qDesigner sometime...


    I've used ERwin for years and find it indispensible (for SQL Server...I can't speak to Orable schema gen). The only thing that gets me from time to time is when I forget to explicitly specify an index as nonclustered; it defaults to clustered in SQL Server.

    What's yer beef with it?
  • (cs)
    Alex Papadimoulis:
     

    <FONT color=#000099>begin
    if</FONT> <FONT color=#990000>'DATE'</FONT> = <FONT color=#990000>'NUMBER'</FONT> <FONT color=#000099>and</FONT> length(<FONT color=#990000>'DATE'</FONT>)>0 <FONT color=#000099>and</FONT> length(<FONT color=#990000>''</FONT>)>0 <FONT color=#000099>then</FONT>
      (<FONT color=#990000>'DATE'</FONT> = <FONT color=#990000>'NUMBER'</FONT> <FONT color=#000099>and</FONT> length(<FONT color=#990000>'DATE'</FONT>)>0 <FONT color=#000099>and</FONT> length(<FONT color=#990000>''</FONT>)=0) <FONT color=#000099>or</FONT>
     
    Yeah... But... what happens if length('DATE')>0 and length('')<0???
    huh? Did they even THINK of that case? Stoopid generator.
  • (cs) in reply to John Smallberries
    John Smallberries:
    RyuO:

    The competing products do at least as silly things as the code fragment (which will work, at least), but they are nowhere near as bad as the bottom feeder CASE tools. Try generating a schema from ERwin or qDesigner sometime...


    I've used ERwin for years and find it indispensible (for SQL Server...I can't speak to Orable schema gen). The only thing that gets me from time to time is when I forget to explicitly specify an index as nonclustered; it defaults to clustered in SQL Server.

    What's yer beef with it?

    The main problem with ERwin for Oracle is that it picks values for the myriad storage values; since v6 Oracle has been moving increasingly towards managing its own storage, so you have to edit the generated DDL to take that stuff out.

    ERwin is also years behind Oracle in feature support. As recently as 2 years ago it did not support Oracle partitions.

     

  • Scott Bean? (unregistered) in reply to jackass

    Doesn't anyone here feel bad for Scott?  I bet they laid him off so they could hire Paula...

  • anon coward (unregistered) in reply to Steve Wahl
    Anonymous:
    Speaking of generated code, has anyone else here ever used Microsoft Excel to generate code?

    I do it occasionally, when I'll have a table of data that needs to be hard-coded into an array or something.  Just insert columns containing the needed spaces and punctuation, then fill down for all the data.  Then just copy/paste the spreadsheet into notepad, s/\t//g, and copy/paste that right into your code.  I've never seen anyone else do this, but I figure there must be others that have done this, since it makes a few specific tasks much faster and less error prone.

    So, you understand s/\t//g, but you find all that faster than the equivalent of
        1,$s/\([0-9]+\) +\([0-9]+\)/ { \1, \2 },/
    in your editor?  (OK, Maybe.  I admit it took a while to come up with that.  Not
    longer than it takes to start excel, but maybe you always have it running.)



    Not so helpful if you have some twisted formula (for sake of argument you want to generate a table for CRC calcs); but I'm sure you could do it in emacs :P - not to say that I haven't found other twisted ways of getting tables I want.
  • Nate Dogg (unregistered) in reply to tdog
    Anonymous:

    I hate Oracle and everything it stands for.  If you like Oracle, then I'm sorry, but you have an illness.  If you are forced to use Oracle because your management doesn't know better, then I'm also sorry. 

    tdog



    I am curious what you feel is a valid alternative ;) Though I tend to agree, I might guess that your DB of choice might also be a steaming pile of crap (unless you are talking about Postgres, then, never mind.).  But, if you are talking about SQL server,  gadzooks! SQL server is teh WORST db there is (yes Alex, worse than MySQL).
  • 604 (unregistered) in reply to Nate Dogg

    Why doesn't SQL Server have support for regular expressions? what year is it?

  • Markku Uttula (unregistered) in reply to Hans Liss

    Umm... Not to mention that everything posted was pretty damn garbled (yes, I know I misspelled that one) up, but checking length of number wouldn't be redundant. Of course, checking the length of "number" would :)

    IHOC 4 Eva...

  • (cs) in reply to 604
    Anonymous:
    Why doesn't SQL Server have support for regular expressions? what year is it?

    It's 2006.  SQL Server got support for Regular Expressions last year.  It also got support for everything else the .Net Framework can do -- like real encryption, file IO, event logging, and a billion other things it was lacking.
  • (cs) in reply to Scott Bean?

    Anonymous:
    Doesn't anyone here feel bad for Scott?  I bet they laid him off so they could hire Paula...

    Actually, Scott did very well for himself: http://www.orafaq.com/faqora.htm#SCOTT

    ...but I'm not so sure about Tiger...

  • cjd (unregistered) in reply to jsmith

    The real WTF here is that Scott gets fired so much he gets a whole column!

  • Zahlman (unregistered) in reply to ammoQ
    ammoQ:

    No, since in Oracle length('') is null.

    ...
    Just for the record, the length(whatever)=0 check is never true in PL/SQL.



    (typos corrected)

    The length of a zero-character string is not zero, but instead specially set to this weird version of the "null" concept that SQL has, which in turn fails to check equal to zero? I vote that's the WTF right there.

  • Beau Gunderson (unregistered) in reply to kipthegreat

    kipthegreat:
    I do it occasionally, when I'll have a table of data that needs to be hard-coded into an array or something.  Just insert columns containing the needed spaces and punctuation, then fill down for all the data.  Then just copy/paste the spreadsheet into notepad, s/\t//g, and copy/paste that right into your code.  I've never seen anyone else do this, but I figure there must be others that have done this, since it makes a few specific tasks much faster and less error prone.

    I do this all the time. I find that lazy people like myself often come up with many tricks like this. Another of my favorites is column edit mode, why copy and paste something on a bunch of lines when you can type it on 500 lines at once?

  • (cs)

    Fo those who do not undestand i give you the template(theoretical) that generated this thing(say if we had it in PHP):
    $fullTableName = "SCOTT"."EMP"
    $name = FIREDATE
    $type = DATE
    $size = '' -empty
    $precision = '' -empty

    begin
    if $type = 'NUMBER' and length($size)>0 and length($precision)>0 then
    execute immediate 'alter table $fullTableName add($name $type($size, $precision))';
    elsif $type = 'INTEGER' or
    ($type = 'NUMBER' and length($size)>0 and length($precision)=0) or
    $type = 'VARCHAR2' then
    execute immediate 'alter table $fullTableName add($name $type($size))';
    else
    execute immediate 'alter table $fullTableName add($name $type)';
    end if;
    end;
    Note that I give $size as an empty string, but the code gives 'DATE', that's probably beacause of substring.
    If this was a FIRENUMBER NUMBER(8,2)
    $name = FIRENUMBER
    $type = 'NUMBER'
    $size = '8'
    $precision = '2'
    You would not have to change a line in the template, and it would still work! GENUS!

  • (cs) in reply to JoshIsGay

    JoshIsGay:
    Fucktard

     

    ahhh. thanks for making me laugh this morning. thanks very much!

  • Benjamin Smith (unregistered) in reply to benvenista
    benvenista:

    apparently they are having some staffing issues if they decided to add a column to their employee table to keep track of when their employees are fired



    Based on the name of the table, I'd guess that "EMP" is a general "employee" table, with name, address, phone #, etc. The real WTF is keeping hiring/firing data in the same table as this other information.

    What happens when you re-hire somebody who worked with you in the past?

    I'm not surprised that they're having some staffing issues, since they can't seem to hire a competent DBA...
  • (cs) in reply to me
    Anonymous:

    you snooze, you lose --  try something shorter next time .... like 'first!'

    or just try not being a knobhead

  • (cs) in reply to Benjamin Smith
    Anonymous:
    benvenista:

    apparently they are having some staffing issues if they decided to add a column to their employee table to keep track of when their employees are fired



    Based on the name of the table, I'd guess that "EMP" is a general "employee" table, with name, address, phone #, etc. The real WTF is keeping hiring/firing data in the same table as this other information.

    What happens when you re-hire somebody who worked with you in the past?

    I'm not surprised that they're having some staffing issues, since they can't seem to hire a competent DBA...


    Wrong, wrong, wrong.
    EMP is a table in the "SCOTT" example database that Oracle installs per default. (Think of MS' Northwind)
    Adding "FIREDATE" was just a pun, because there is already a column "HIREDATE".
  • zootm (unregistered) in reply to mrsticks1982
    mrsticks1982:

    even their light footprint is still 2gb!!! "Oracle is the Devil"


    To be fair, if a 2Gb footprint is a "big thing" to you, you probably don't need Oracle.
  • (cs) in reply to kipthegreat
    kipthegreat:
    Speaking of generated code, has anyone else here ever used Microsoft Excel to generate code?

    I do it occasionally, when I'll have a table of data that needs to be hard-coded into an array or something.  Just insert columns containing the needed spaces and punctuation, then fill down for all the data.  Then just copy/paste the spreadsheet into notepad, s/\t//g, and copy/paste that right into your code.  I've never seen anyone else do this, but I figure there must be others that have done this, since it makes a few specific tasks much faster and less error prone.

    I did that a lot several years ago, typically when I was going to do add a lot of rows in a database (Oracle, at that time, actually) and the INSERTs could easily be created using constant text plus values calculated by Excel. It was probably the easiest way to do those tasks (not very enterprisy though).
  • (cs) in reply to impslayer
    impslayer:
    kipthegreat:
    Speaking of generated code, has anyone else here ever used Microsoft Excel to generate code?

    I do it occasionally, when I'll have a table of data that needs to be hard-coded into an array or something.  Just insert columns containing the needed spaces and punctuation, then fill down for all the data.  Then just copy/paste the spreadsheet into notepad, s/\t//g, and copy/paste that right into your code.  I've never seen anyone else do this, but I figure there must be others that have done this, since it makes a few specific tasks much faster and less error prone.

    I did that a lot several years ago, typically when I was going to do add a lot of rows in a database (Oracle, at that time, actually) and the INSERTs could easily be created using constant text plus values calculated by Excel. It was probably the easiest way to do those tasks (not very enterprisy though).


    I do that regulary, when I have an excel sheet with data to insert into the database. By generating insert statements, I have a chance to know exactly what will be inserted. (In most cases I do that when I'm not connected to the database, so some fance ODBC connector would not help at all)
  • (cs) in reply to Josh
    Anonymous:
    argh... by the time I posted I was no longer first.


    Yeah, thanks for your contribution. twice. It's good to see who's first, and who's not. After all, simply seeing a post at the top isn't enough to tell us it's first, it has to say it too.
  • (cs) in reply to snow
    Anonymous:

    we have a whole damn hospital of 3000 people running on an enterprise oracle database.  remote hosted in another state.  accessible via citrix.  over two T1 lines.  integrated with onsite stand-alone oracle databases (supplied by seperate vendors) via HL7 interfaces.  at my last count, we had 8 seperate oracle databases at our hospital.  =(



    HL7. There's another WTF right there

    I as often fondly say, HL7 is a non-standard.
  • (cs) in reply to ammoQ

    ammoQ:
    GoatCheez:
    I'm no DB guru, so correct me if i'm wrong but isn't length('')=0 like saying 3==3 ?


    No, since in Oracle lenght('') is null. A good chance to write endless-loops in PL/SQL..

    Is that so? If that is TRUE I would call that a major WTF

  • (cs) in reply to jannes
    jannes:

    ammoQ:
    GoatCheez:
    I'm no DB guru, so correct me if i'm wrong but isn't length('')=0 like saying 3==3 ?


    No, since in Oracle lenght('') is null. A good chance to write endless-loops in PL/SQL..

    Is that so? If that is TRUE I would call that a major WTF


    Having the empty string '' equivalent to NULL is something a lot of people have a LOT to say about, but when you think about it, it makes sense... Some sense, anyway. Not that it really FEELS right in the bones, but SOME sense it makes... Patience you have not... Erm... WTF?
  • (cs)

    The Oracle redneck (http://dba-oracle.com/oracle_news/2005_5_9_why_i_hate_club.htm), that is?

  • Oracle Boy (unregistered) in reply to ammoQ
    VGR:

    Ouch. PL/SQL developer is XXXXXXXXXX. TOAD is much better, though it's expensive. The new tool, SQLDeveloper, seems like a good tool for PL/SQL development to me (despite today's WTF ;-).
    My favourite editor for PL/SQL is Slickedit.


    I strongly beg to disagree on this.  PL/SQL developer can do anything TOAD can do, if not more.  People only sweat TOAD because it came first and is synonymous with IDE's.  PL/SQL is around $200 - TOAD runs over $500 plus every additional module you need sends that number higher and higher.  What exactly do you not like about it?

    Anyway enough about which one is better.  If you are using an IDE to insert, update, delete data in your database directly (instead of writing your own sql), you should not complain.  Beggars can't be choosers.  I agree its horrible code, but its meant to be a general template.  The real question is why are you letting someone ELSE write your SQL instead of writing it yourself???




  • (cs) in reply to Oracle Boy

    Poor Scott. Seems like he tried to prove his loyalty to the management by implementing all their requests until the last moment. That explains FIREDATE.

  • (cs) in reply to XMLord

    <font style="font-family: verdana;" size="1">

    Anonymous:
    <span style="font-size: 12pt;" times="" new="" roman="" ;="">
    So if one code generation tool is bad, all code generation is bad? Why don't you just say that all programmers are bad?

    </font>
    <font size="2">All programmers are bad.  I thought that was obvious.  It's amazing that the entire software industry hasn't imploded on itself yet.


    </font>

  • (cs) in reply to cconroy
    cconroy:
    <font style="font-family: verdana;" size="1">
    Anonymous:

    So if one code generation tool is bad, all code generation is bad? Why don't you just say that all programmers are bad?

    </font>
    <font size="2">All programmers *are* bad.  I thought that was obvious.  It's amazing that the entire software industry hasn't imploded on itself yet.


    </font>

    I second that, programmers really are crap... Enterprise Architects on the other hand...
  • (cs) in reply to Oracle Boy
    Oracle Boy:

    I strongly beg to disagree on this.  PL/SQL developer can do anything TOAD can do, if not more.  People only sweat TOAD because it came first and is synonymous with IDE's.  PL/SQL is around $200 - TOAD runs over $500 plus every additional module you need sends that number higher and higher.  What exactly do you not like about it?

    I admit I confused "PL/SQL developer" (from allroundautomations.com) with some other tool from a distant past. Since I don't know "PL/SQL developer", please consider my prvevious statements about it void.

    The real question is why are you letting someone ELSE write your SQL instead of writing it yourself??

    Because I was toying around with the new tool from Oracle?
  • (cs) in reply to FascistBaby
    Anonymous:
    kipthegreat:
    Speaking of generated code, has anyone else here ever used Microsoft Excel to generate code?
    ...
    Then just copy/paste the spreadsheet into notepad, s/\t//g, and copy/paste that right into your code.


    Are you mixing editors here? I can't imagine Notepad does sed. How do you search on a tab character? Or do you paste one into the dialog box from somewhere else?

    A different type of code generator you all might appreciate:

    World's 2nd and 3rd Simplest Code Generators
    http://secretgeek.net/w2scg.asp
    http://secretgeek.net/w3scg.asp

    FascistBaby, since I usually work remotely throught a ssh shell, I use a "for" loop on the bash command line, and dump the output on a file, because I'm too lazy to copy/paste the output from my machine to the shell.

    #(all in one line, mind you)
    i=0;
    while [[ $i -lt 100 ]]; do  
      let i=i+1; 
      echo "insert into table dummy values('dummy$i')" >> insert_dummy.sql; 
    done;
    
    insert into table dummy values('dummy1')
    insert into table dummy values('dummy2')
    insert into table dummy values('dummy3')
    insert into table dummy values('dummy4')
    insert into table dummy values('dummy5')
    ......
    
    

    On notepad, I just have to copy/paste one of the tabulators I'm trying to replace :)

    By the way, those generators you linked to are breaking on me when I replace whiskey for cussing'. Seems like the program chokes on the apostrophe character:

    An error occurred while applying the pattern to the list.
    Description: 'The stylesheet does not contain a document element.  The stylesheet may be empty, or it may not be a well-formed XML document.
    '
    
  • (cs) in reply to Enric Naval
    Enric Naval:

    By the way, those generators you linked to are breaking on me when I replace whiskey for cussing'. Seems like the program chokes on the apostrophe character:

    An error occurred while applying the pattern to the list.
    Description: 'The stylesheet does not contain a document element.  The stylesheet may be empty, or it may not be a well-formed XML document.
    '
    

    So it does. The code:

    $if $2="fightin'" then
      (i'm with you $1!!!)
    $end if


    becomes:

    >xsl:if test='field[@number=2]="fightin'"'< (i'm with you >xsl:value-of select="field[@number=1]"/<!!!)
    >/xsl:if<

  • Worf (unregistered) in reply to Digitalbath
    Digitalbath:

    kipthegreat:
    Speaking of generated code, has anyone else here ever used Microsoft Excel to generate code?

    I do it occasionally, when I'll have a table of data that needs to be hard-coded into an array or something.  Just insert columns containing the needed spaces and punctuation, then fill down for all the data.  Then just copy/paste the spreadsheet into notepad, s/\t//g, and copy/paste that right into your code.  I've never seen anyone else do this, but I figure there must be others that have done this, since it makes a few specific tasks much faster and less error prone.

    Yes.  I can't think of any specific code examples, but I remember the time I did it when I was creating some data for the first time.  I had a bunch of chart names that needed to be entered into a table and it was much faster to type chartname_1, chartname_2, and then fill down to 40 or so and import than any other sort of copy/paste/backspace/type number method or programming any sort of quick and dirty method for it.



    I do it in Excel too for arrays of data - often the data comes in an oddball format, and using some deft Excel tools and transformations (Import as Text works wonders!), then I add columns as necessary to generate the code. Quite handy for tabular data. I often don't even bother with whitespace removal (most compilers will accept excess whitespace). And if you're generating the table, Excel helps greatly for that purpose as well.A very welcome efficiency...
  • (cs) in reply to zootm

    Apparently they have a non-server version that runs on 3MB of disk space. Too many people who only really need TOAD or POL install Oracle Server because that 'Oracle' to them.

    "Personal Oracle Light (POL) is a lightweight, single-user object/relational database that runs on desktops, laptops, down to the smallest hand help devices. It is designed for mobile and distributed applications. Some of the main features are:

    POL runs in under 1 megabyte of memory, and can be installed in 3 megabytes of hard disk space;"

Leave a comment on “Orable Generated Code”

Log In or post as a guest

Replying to comment #:

« Return to Article