I'm executing some random script to my local database and I have problem with non-english letters. When I'm executing the same insert statement directly from sql develeoper everything is ok. Could somebody explain my how can I avoid this problem using sql script?
Example. Everything works okay.
Statement: insert into my_table values ('aaaaała');
Result: 'aaaaała';
Now I'm pasting the same insert statement into my sql file(script.sql) and I'm wirting:
#'D:\script.sql';
'D:\' - it is location of that file
Statement: insert into my_table values ('aaaaała');
Result: 'aaaaała';
The result is wrong:
My settings:
You must set your NLS_LANG value according to the character set of the script.sql file. Typically you set this in the options in at the "Save" dialog.
For example if the .sql file was saved as UTF-8 then you must run:
set NLS_LANG=.AL32UTF8
sqlplus .... #'D:\script.sql';
See also OdbcConnection returning Chinese Characters as "?" for more details.
I have a file that I cannot edit that uses :: as the delimiter. I'm using the following sql formula to copy the contents of the file to a postgresql database:
cur.execute("COPY table_name (col_1,col_2,col_3,col_4) FROM 'file_path' WITH DELIMITER ':'")
When I execute this code the program throws DataError: extra data after last expected column. This appears to be happening because sql is inserting a blank column when it parses the colon character for the second time. SQL doesn't allow the use of multiple character delimiters so '::' is not an option.
I'm wondering if there's a best practice for this situation. Maybe some way to ignore the second colon?
I try to run several SQL-Statements in an SQL Script action for an Oracle dbms inside an installer and as part of a JDBC container action.
The script is encoded as UTF-8, and contains several statements, delimited by ";" and a new line between each statement, like this
statement 1;
statement 2;
...
The statements contain installer variables that are replaced before execution. I used the semicolon as a statement separator in the SQL script action.
The first statement throws an error
Error executing script line "CREATE user testconuser identified by xxx TEMPORARY TABLESPACE temp;",
error message: "ORA-00911: invalid character"
The statement itselfs works fine within SQLPLUS, but the problems seems to be the semicolon, that is still part of the statement executed by install4j.
In a JDBC sql statement, semicolons are not valid.
I also tried to remove the semicolons from the statements and used "\n" as statement delimiter, but then the sql script actions fires all sql statements within the script at once, so it looks like the "\n" is not recognized.
I am using install4j 6.1.5 build 6349. The platform is windows and the sql script is build on windows.
Any idea what I should change?
Any help would be highly appreciated, thanks a lot in advance,
Alex
I used the semicolon as a statement separator in the SQL script action. The first statement throws an error Error executing script line
and
I also tried to remove the semicolons from the statements and used "\n" as statement delimiter
Both are bugs in 6.1.5 and will be fixed in 6.1.6. Please contact support#ej-technologies.com to get a build where you can verify that this will work for you.
I am using Oracle SQL Developer 4.0.3.16, and since a few weeks, the shortcut Ctrl+Enter doesn't execute the current line or statement anymore, except for when I highlight it, but instead does run my whole worksheet. Using the green button on the top, which is supposed to only run the current line results in the same behaviour (except for when the line is highlighted). Hovering over the button still reveals the tooltip "Run Statement (Ctrl+Enter)". A colleague of mine does get this problem too.
I also looked into the Preferences->Shortcut Keys menu, but the shortcut set for running a statement is still Ctrl+Enter.
Anyone knows what's wrong with my SQL Developer?
Every SQL statement in SQL Developer should have semicolon ; otherwise ctrl+Enter would execute will execute entire worksheet.
Suppose for example I have two SQL statements:
1.select * from emp without semicolon ;
2.UPDATE EMP SET DEPT_ID=10; WITH SEMICOLON ;
Then it will execute both statement simultaneously for that you should have semicolon after each SQL statement.
I faced it too. Usually you'll have PL/SQL block above the SQL code you are trying to execute. Comment out the PL/SQL block which is DECLARE, BEGIN without ending in semicolon creating this issue. So commenting the PL/SQL block in worksheet should solve your issue.
Thanks to the answer here: if it doesn't work even with a semicolon after the line like it didn't for me (Oracle SQL Developer 3.2.20.10), you need to put a '/' after each command if you want to execute them all independently, e.g.:
blahblah;
/
blahblah;
/
Think of the '/' as the real terminator/separator here.
I think I kinda solved it.
Since I'm not an administrator on the computers at work I couldn't install a new client, so I downloaded the SQL Developer in version 4.0.3.16 a while ago and just ran it locally from my user directory.
Meanwhile the client 4.0.3.16 is installed on the OS and when using this client I don't get this bug.
Thanks for the help though.
I tried to execute an SQL INSERT with Toad for oracle:
INSERT INTO GRAT_ACTIVITY
(UUID, IP_ADRESS, SEND_MAIL, DATE_CREA, DATE_UPD, CREATOR, CENTER, ETAT, REQUEST)
VALUES('555-vgd9-pllkd-5513', '172.12.23.130', 'N', SYSDATE, SYSDATE, '1554', 'M18', 'I', 8842);
--COMMIT;
the GRAT_ACTIVITY table structure is as below:
CREATE TABLE CASH.GRAT_ACTIVITY
(
UUID VARCHAR2(64 BYTE) NOT NULL,
IP_ADRESS VARCHAR2(15 BYTE),
SEND_MAIL VARCHAR2(1 BYTE),
DATE_CREA DATE,
DATE_UPD DATE,
CREATOR VARCHAR2(4 BYTE),
CENTER VARCHAR2(4 BYTE),
ETAT VARCHAR2(1 BYTE),
REQUEST NUMBER
)
the error message:
ORA-00911: invalid character
Cause: identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first
character. Identifiers enclosed by doublequotes may contain any
character other than a doublequote. Alternative quotes (q'#...#')
cannot use spaces, tabs, or carriage returns as delimiters. For all
other contexts, consult the SQL Language Reference Manual.
Action: None
How can I solve it?
The statement you're executing is valid. The error seems to mean that Toad is including the trailing semicolon as part of the command, which does cause an ORA-00911 when it's included as part of a statement - since it is a statement separator in the client, not part of the statement itself.
It may be the following commented-out line that is confusing Toad (as described here); or it might be because you're trying to run everything as a single statement, in which case you can try to use the run script command (F9) instead of run statement (F5).
Just removing the commented-out line makes the problem go away, but if you also saw this with an actual commit then it's likely to be that you're using the wrong method to run the statements.
There is a bit more information about how Toad parses the semicolons in a comment on this related question, but I'm not familiar enough with Toad to go into more detail.
Remove the semicolon (;), backtick (``) etc. from inside a query
Remove the semicolon ( ; ).
In oracle, you can use semicolon or not when u ran query directly on DB. But when u using java to ran a oracle query, u have to remove semicolon at the end.
If a special character other than $, _, and # is used in the name of a column or table, the name must be enclosed in double quotations.
Link
I encountered the same thing lately. it was just due to spaces when copying a script from a document to sql developer. I had to remove the spaces and the script ran.
I'm using a 3rd party program that executes Oracle SQL and I encountered this error. Prior to a SELECT statement, I had some commented notes that included special characters. Removing the comments resolved the issue.
I had the same problem and it was due to the end of line. I had copied from another document.
I put everythng on the same line, then split them again and it worked.
The option(s) to resolve this Oracle error are:
Option #1
This error occurs when you try to use a special character in a SQL statement. If a special character other than $, _, and # is used in the name of a column or table, the name must be enclosed in double quotations.
Option #2
This error may occur if you've pasted your SQL into your editor from another program. Sometimes there are non-printable characters that may be present. In this case, you should try retyping your SQL statement and then re-execute it.
Option #3
This error occurs when a special character is used in a SQL WHERE clause and the value is not enclosed in single quotations.
For example, if you had the following SQL statement:
SELECT * FROM suppliers
WHERE supplier_name = ?;
You probably copied and pasted the SQL from another source, and it screwed up something somehow. . . I don't know how or why lol.
Re-type your sql in whatever IDE you are using, and it should work.