Giter Club home page Giter Club logo

Comments (42)

Danieleeee avatar Danieleeee commented on August 23, 2024 1

ok, thanks.
If anyone wants to implement automatically, these are the two configurations to be given depending on whether you are using windows1252 or UTF8:

- windows1252
chcp 1252
set NLS_LANG = .WE8MSWIN1252
- UTF8
chcp 65001
set NLS_LANG = .UTF8

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024 1

ok, thanks.
Whit this bat it works:

chcp 1252 
set NLS_LANG=.WE8MSWIN1252
sqlplus %*

without NLS_LANG it doesn't work, even if I set the value inside "oradew.envVariables"

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Hi, do you use sqlplus or sqlcl?

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

sqlplus

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

If you can I suggest you always force encoding on utf-8 with sqlplus.
It is the only one who works correctly.

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Take a look at #28 (comment) and followed comments.

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

It doesn't solve my problem.
There is a bug with running the selection.
I created a file with this code:

GRANT EXECUTE ON CONF_SET_VAL_TIPI_CONN_SVI TO NETAINF;
GRANT EXECUTE ON CONF_SET_VAL_TIPI_CONN_SVI TO SIU;

If I run it with f5 (run as script) it works, with Run Selected Statement, no.
If I delete only one of the two lines, the execution is performed correctly, with both lines not.

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

It appears that it cannot execute the two selected lines. If I select only one, it works.
The error is as follows:
ORA-00933: SQL command not properly ended
Reported at the end of the first line

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Correct. A command like "Run Selected Block as a Script" is missing or a proper parser to compile a multi-statement code.

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

Hi,
for the problem with utf8 encoding there is no solution (#42 (comment)).
My oracle DB doesn't use utf8 encoding, but sqlplus uses it instead.
I tried to enter this configuration but nothing changes:
"oradew.envVariables": {
"NLS_LANG": "ITALIAN_ITALY.WE8MSWIN1252",
}

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Have you tried setting "source.encoding" to "win1252"? Import object again after that to correctly encode it. This is what I use.

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

the encoding of the file is correctly windows1252, like Oracle configuration.
when launched to DB from sqlplus (f5), UTF8 encoding is always applied and special characters such as this § are not encoded correctly.
are you sure that the parameterization "oradew.envVariables" is taken correctly?

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

Is there no way to tell sqlplus not to apply UTF8 encoding, but Windows1252?

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

I am not sure, I thought this was the case with setting nls_lang variable based on a user's comment, but I don't use it. I use win1250 encoded files to run to win1250 DB and it works, but I also have win1250 default lang on my OS system, which I think is the encoding that sqlplus applies. I guess in your case default OS encoding is UTF-8.
What about using UTF-8 encoded files? Is there a way you normally do to run a file with just sqlplus that works for you?

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

The system language is ITALIAN_ITALY.WE8MSWIN1252
The files are launched correctly on the DB, not by execution error. But if they are then opened, if there are special characters in some comments or strings, they are badly coded.

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Hmm. Check also the vscode encoding in which the file is open - in the right bottom corner of status panel.

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

image

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

So you launch with sqlplus a file written with win1250 encoding, on an Oracle DB with NLS_CHARACTERSET = win1250 and the special characters like this "§" are not altered?

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

That's right, I use many ČŠŽ in comments and other "strange" chars. My Win OS codepage is also 1250. I use sqlcl now but it worked with sqlplus also. Have you tried running files encoded in UTF-8?

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

it seems the problem is in Oracle's charset, other than UTF8.
what is your Oracle DB NLS_CHARACTERSET?

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

That shouldn't be the case, my charset on DB is also .WE8MSWIN1250.
Take a look at: https://dba.stackexchange.com/questions/207537/problem-with-charset-on-sqlplus maybe you will got some idea.

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

It seems a problem related to machines that use Windows.
You should fix this by placing this code before the call to SQLPlus

C:\>chcp 1252
C:\>set NLS_LANG=.WE8MSWIN1252

i verified that by entering those two commands before running sqlplus, everything works fine

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

In my case just give:
chcp 1252

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

Can you create a parameter that makes me enter "chcp" before executing the sql code?

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

#28 (comment)

Take a look at this comment. You create a sql.bat file and then set setting "oradew.cliExecutable": "sql.bat" to execute with parameters through this bat script...

Please let me know if you can make it work. 🤞

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

I created a bat with this but it doesn't work. the plsql instruction appears to be executed in a different session.
bat file:

chcp 1252
set NLS_LANG = .WE8MSWIN1252
sqlplus UTE/PASS@DBNAME @"File.sql"

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

if I set this bat, Oradew ask me user and password for sqlplus:

chcp 1252
set NLS_LANG = .WE8MSWIN1252
sqlplus

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Write
sqlplus %*
As in example so that parameters are passed through...

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Thanks for your info. This is a workaround to pass variables to executable.

Maybe we can add this solution to documentation or Howto's for others to easly find it, so @Danieleeee if you feel like contributing, please go ahead!

If you are satisfied you can also consider just adding a star to this project. :)

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

because of you.
star added ;)

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

Note that this solution does not work in the "compile current file" command, only in "Run ad Script (f5)".
It would be helpful to fix it. It should occur on all Windows machines that have ANSI codepages.

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Have you tried setting "source.encoding" to "win1252"? Import object again after that to correctly encode it. This is what I use.

Compile task uses different method. chcp doesn't have any means here as node-oracledb executes always in UTF-8 and doesn't bother about system codepages.
Setting "source.encoding" parameter is here so that oradew first decodes file content from file encoding to UTF-8 before compiling, and encodes it back after importing.
But it doesn't work for you?

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

the problem is that they are always executed in UTF8.
It gives problems with the code page of the machine, if we are on windows and the file (and Oracle DB) we are executing is not encoded in UTF8.
if you have a windows machine you can give it a try.

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

I use it all the time and it works as I explained in the comment above. Have you tried exporting existing object from db, then adding some comments and compile again?

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

No, I'm always working with the same file written in Windows1252.
If I compile it gives problems with the coding, if I run it as a script no because I use the bat with chcp 1252.

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Can you send an example file so I can reproduce? And please describe what is that you do, f.ex. compile a specific char in comments and then not expected result on DB, etc...

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

I can't attach a file.sql so i write it here.

CREATE OR REPLACE PACKAGE TEST_PCK AS

  v_test   varchar2(100):= '§';
 
END TEST_PCK;
/

Put it in a file with windows1252 encoding.
Run the Oradew "Compile Current File" command.
If the DB has Windows1252 encoding, you will not correctly see the '§' character.
Processing is launched from a Windows 10 machine

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

Strange. NLS_LANG on my DB is .EE8MSWIN1250, I made a file encoded in Windows 1252 exactly as you suggested, compiled, checked on DB and it is '§'.
I have "source.encoding": "win1250", in oradewrc.json file, if I remove that, I get '?' instead of '§' on DB.
I don't have set any environment variables for NLS_LANG with "oradew.envVariables" or anywhere else...

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

yes, if i use oradewrc.json it works.
Thanks

from oradew-vscode.

Danieleeee avatar Danieleeee commented on August 23, 2024

Last thing, because when I import a package it writes: "CREATE OR REPLACE EDITIONABLE PACKAGE BODY".
how do i delete "EDITIONABLE"?

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

This has to do with your database configuration - editions. I am not very familiar with this topic.

You can customize object DDL that is imported with oradewrc setting: import.getDdlFunction in a way that you write your own function to import objects...

from oradew-vscode.

mickeypearce avatar mickeypearce commented on August 23, 2024

@Danieleeee , I closed this issue, feel free to open a new one if you have more questions, bugs, etc.

from oradew-vscode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.