3

I am not sure if this is more suited for Superuser or Stackoverflow, but here goes...

A little bit of background:

I'm learning SQL and was trying to make a very large table which I could use for optimization tests. Something generic with random values. I created a little Java program to do just that, and was able to put out a text file with 100,000 lines, each line being an SQL INSERT statement for a new random record. However, with anything much bigger than 100,000 lines, I had problems either opening/using the text file in any text editor, or copying/pasting the text to the windows clipboard and then into SQL Developer so I could execute it as a script.

I'm probably overlooking something really obvious, or doing something really stupid. There has got to be a better way to do this, but I couldn't find anything through Google or Stackoverflow or Superuser.

5
  • 2
    Is there a reason why you can't open and run the file in containing the SQL in Developer rather than pasting its contents into the the window?
    – Paul
    Nov 17, 2011 at 1:57
  • Notepad++ can open large files, but I'd have thought SQL Developer should be able to as well. On copy/paste, the clipboard itself has limits - I don't know what they are for plain text, and I'd be surprised if the clipboard limits were the issue here (after all, you can copy-and-paste graphics and other media content), but copy/paste looks like the wrong solution here.
    – user31438
    Nov 17, 2011 at 2:04
  • @Steve314 I created a 1,000,000 line file as an output from my Java program. You are right, Notepad++ can open it. But SQL Developer does not seem to be succeeding... I tried to open it like 10 minutes ago and it is still just sitting there with a grey screen.
    – The111
    Nov 17, 2011 at 3:07
  • Yeah, isn't the whole point of writing this script to a text file is so you can open it later in another program? The clipboard is just to move parts of a file.
    – surfasb
    Nov 17, 2011 at 3:09
  • FYI: this definitely belongs here. Not SO
    – user517095
    Jun 11, 2017 at 21:24

2 Answers 2

2

AutoIt is a freeware Basic-like scripting language. Among its tricks, it can send fake keypresses to another program. This means that in principle, you could write a script that opens SQL Developer, waits for it to wake up, opens the right window, and does batches of those insert commands with a timed delay in between to give Developer a chance to catch up and empty the keyboard queue.

You can do some similar tricks with VBScript and the Windows Scripting Host, which you should already have, but I found AutoIt easier. I use it to automate a few jobs that would be a pain otherwise.

I still agree with Paul, though - it should be possible to load and run that script directly in SQL Developer. If you're trying to avoid learning how for the moment, you'll end up doing much more work learning other things to avoid it.

2
  • I tried to open it in SQL Developer using file > open and it is just kind of frozen on a grey screen. Is there another method I should be using?
    – The111
    Nov 17, 2011 at 3:07
  • @Johnson - I don't know SQL Developer, I'm afraid. Most scripts are small. Maybe it just can't load huge scripts. In that case, your options are basically external automation tools or APIs - maybe you can directly create your database using a Java program to work with a SQL API for instance or, as I said, maybe AutoIt can script it. Notepad++ can record and playback keypress macros, which should be enough to convert your existing script into an AutoIt script.
    – user31438
    Nov 17, 2011 at 4:05
-2

the easiest way to copy and paste large amounts of text is to do a combo or a keystroke you may think a keystroke sound complex and complicated but its actually very easy so just have your little line thing blinking in the text or beside it just press and hold the ctrl key and then press the A key its that simple see.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .