Toad World® Forums

Import binds from file in new session

Hi,

Sometimes I have a request to test some optimization SQLs agains several hundreds of binds set.
For that I have wrote a utility that generate a file in a way that SQL Optimizer save it.

i.e.

QSOBindvars
"QSOSetName",":b0",":b1",":b2",":b3",":b4",":b5",":b6",":b7"
"QSODataType","NUMBER","VARCHAR2","VARCHAR2","NUMBER","NUMBER","NUMBER","NUMBER","NUMBER"
"Set 1","350932188","20031103","20160927","-1","0","0","9999999","1"

...
"Set 1076","343972578","20031103","20160930","-1","0","0","9999999","1"

But when I want to import it into new optimizer session (no binds were imported before!!!) I got mixed data and errors.

When I remove first three rows and all "Set xxx" column from mine file, I can import data but then I have to define manually many columns data types.

How to make it work without human touch ?

Brg

Damir

Hi Damir,

When you import bind values, after selected the importing file, you will see an “Import File Format” dialog box if your importing file is not recognized as a file saved (or exported) by SQL Optimizer. From your screenshot, it looks like you have encountered this dialog box. In other words, the file you have tried to create is not recognized as the export file from SQLOptimizer. One possible reason is that there are extra spaces in the lines which is not SQL Optimizer expects. You may try to enter a few bind value sets in the UI and click Export to create a sample file and then compare with what you have created by the utility. Paid attention to the different of the spaces in the 2 files. Another possibility is that the newline characters in the 2 files are different. Hope this would help you find out why the format is not recognized.

Thanks,

Alex

Hi Alex,

I’m very well aware of that dialog. But if you put only data then format types and some other stuff needs to be defined manually.
If you import the same file as it was exported you have situation form mine picture.

So, please instead of advice, try by yourself.
:slight_smile:

And then return some info.

Hi Damir,

Having another closer look at your data, I think your data seems to be in a correct format. So another thing to check is the file encoding used. Please make sure your file is saved using “Unicode” encoding instead of ansi.

Thanks,

Alex

Hi Alex,

  1. Fill one row.

  2. export data

  3. close session (DO NOT SAVE IT)

  4. create new session 8same query)-go to binds again

  5. import previously export file (from SQL optimizer…directly your app work!!)

You have situation from picture…what am I doing wrong?

Hi Damir,

I did try creating an importing file from scratch and can see that the data can be imported successfully if the file content is exactly what SQL Optimizer expects. That is how I find the spacing easily being overlooked but will cause SQLOptimizer not able to recognize the file format. Then I looked at your data closer and realized that you have the spaces right. Sorry that I have not spotted this earlier.

Have you checked the encoding of the file saved? Please again make sure that it is saved under Unicode encoding. Note that if I create the file with no extra spaces and with the correct unicode encoding, I can import the file correctly. So if you still have problem after checking, please send me your file and SQL.

Regarding your last response with steps provided, I have also tested the same. There is no problem importing the file on my side except that the last bind value may not be saved correctly if there was no focus change in the last edited cell of the grid. That is, if I entered value in a cell without leaving it before exporting, the entered value in the last cell will not be saved. This is a bug and I have recorded it for future fixing. Apart from that, the import works on my test.

Thanks,

Alex

Alex,

Mine values are encoded in ANSI, what is default for windows.

I do not see that option in import dialog, why?

please write me on mail or send me your mail.

Something is not OK still and need your help.

When I encoded to UTF8, all works fine.

So please add “Encodded in ANSI” what is default for 90% of windows.

FYI, your export of binds file is “UCS-2 Little Indian” format, very rare I must admit.

:slight_smile:

I have logged a request to revise the encoding and make sure ANSI will be supported. Thank you for the feedback.

great.

And make it default please!

Brg,**
________________________**

Damir Vadas
http://damir-vadas.blogspot.com

It does not matter what you have in your life, but who!

Razmislite o čuvanju okoliša prije nego odštampate ovaj e-mail
Please consider the environment before printing this email

On Thu, Nov 3, 2016 at 1:11 PM, Alex Luk bounce-AlexLuk@toadworld.com wrote:

RE: Import binds from file in new session

Reply by Alex Luk
I have logged a request to revise the encoding and make sure ANSI will be supported. Thank you for the feedback.

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or Unsubscribe from SQL Optimizer for Oracle Forum notifications altogether.

SQL Optimizer for Oracle - Discussion Forum

Flag this post as spam/abuse.