"quoted string not properly terminated" sqlplus [closed] - sql

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Getting an error when I try to insert values using the following statement
INSERT INTO PRODUCT (PRODUCT_NUM, ITEM_NUM, DATE)
VALUES (’11’,’19’, TO_DATE(’01-JAN-2001’,’DD-MON-YYYY’));
ERROR:
ORA-01756: quoted string not properly terminated

Your question has "smart" quotes in the SQL instead of basic single quotes. Try this:
INSERT INTO PRODUCT(PRODUCT_NUM, ITEM_NUM, DATE)
VALUES ('11', '19', DATE '2001-01-01')
(I prefer the date keyword for specifying date constants in Oracle.)

INSERT INTO PRODUCT (PRODUCT_NUM, ITEM_NUM, DATE)
VALUES ('11','19', TO_DATE('01-JAN-2001','DD-MON-YYYY'));
use this code as you used wrong quote type

It's almost certainly because you're using the wrong quote types, something that often happens when you cut'n'paste text from a word processor.
Your example has "angled" quotes rather than the correct ' variant, meaning that either that's the actual problem, or that you've transcribed it incorrectly which leads me to think you're not matching quotes correctly.
This is what you should have:
INSERT INTO PRODUCT (PRODUCT_NUM, ITEM_NUM, DATE)
VALUES ('11','19', TO_DATE('01-JAN-2001','DD-MON-YYYY'));

use a normal quote, your quote seems to be odd.

Related

MySQL CONCAT cannot concat more than 2 items [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 months ago.
Improve this question
I am currently studying SQL and am completing Hackerrank Questions (this is the question). The question involves concatenating strings. However when I use CONCAT according to convention, i.e:
SELECT
CONCAT(NAME, '(', LEFT(Occupation,1), ')')
FROM
OCCUPATIONS;
I receive the following error:
> SQL0440N No authorized routine named "CONCAT" of type "FUNCTION" having compatible arguments was found. SQLSTATE=42884
However, if I enter the following code:
SELECT
CONCAT(NAME, CONCAT(CONCAT('(', LEFT(Occupation,1)), ')'))
FROM
OCCUPATIONS;
The code runs correctly and I receive the following output:
Kristeen(S)
Maria(P)
Meera(P)
Naomi(P)
Priya(D)
I have tried to use escape characters to no avail. I am able to concatenate any of the two strings fine however when I attempt to join any more than that in the cone CONCAT function I am unable.
Is this an error with my code, or an error with the platform? I have reviewed other solutions online that is coded exactly like the first solution and they are able to submit.
The issue was that on Hackerrank I had not changed the language from DB2 to MySQL in the top right hand corner, the error I was receiving was because I was using MySQL syntax where it wasn't supported.

SQL - Datatypes varchar and varchar are incompatible in the modulo operator [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed last year.
Improve this question
I have the following query that used to work but returns the error addressed on the title. The last line is indicated within the error.
UPDATE [dwh].[dbo].[opco_securty]
SET opco_general = REPLACE([dwh].[dbo].[opco_securty].opco_general, [MSTR_MD].[dbo].[v_OpcoGeneral_UserList].ABBREVIATION, '''')
FROM [dwh].[dbo].[opco_securty]
JOIN [MSTR_MD].[dbo].[v_OpcoGeneral_UserList]
ON [dbo].[opco_securty].opco_general LIKE CONCAT(''%'', [MSTR_MD].[dbo].[v_OpcoGeneral_UserList].ABBREVIATION, ''%'');
Change this
ON [dbo].[opco_securty].opco_general LIKE CONCAT(''%'', [MSTR_MD].[dbo].[v_OpcoGeneral_UserList].ABBREVIATION, ''%'');
To this
ON [dbo].[opco_securty].opco_general LIKE CONCAT('%', [MSTR_MD].[dbo].[v_OpcoGeneral_UserList].ABBREVIATION, '%');
Because the goal is to concatinate the % character to the column. So that it creates a string that's usable by the LIKE.
But in MS Sql Server you escape a single quote with a single quote.
So the ''%'' is messing things up.
Because the % is seen as the modulus operator.

Postgres Error : syntax error at or near "(" [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I am getting this error
ERROR: syntax error at or near "("Position: 65```
for the following query
insert into Employee(no,name,phone) values ((1,Kenit,999999999)(2,Kenit,999999999)(3,Kenit,999999999)(4,Kenit,999999999)(5,Kenit,999999999)(6,Kenit,999999999))
Probably you need commas between paranthesis for each record. And "Kenit" should be in quotes
insert into Employee(no,name,phone) values ((1,'Kenit',999999999),
(2,'Kenit',999999999),(3,'Kenit',999999999),(4,'Kenit',999999999),
(5,'Kenit',999999999),(6,'Kenit',999999999))
Try googling.
Source: https://www.sqlservertutorial.net/sql-server-basics/sql-server-insert-multiple-rows/
INSERT INTO table_name (column_list)
VALUES
(value_list_1),
(value_list_2),
...
(value_list_n);
INSERT INTO Employee (no,name,phone) VALUES ((1,Kenit,999999999),(2,Kenit,999999999),(3,Kenit,999999999),(4,Kenit,999999999),(5,Kenit,999999999),(6,Kenit,999999999));
happy to help
also: phone numbers should be saved in strings, as well as your names. so adding quotation marks helps not only in readability of the code it gives required LOGIC:
example:
...('asdf', 123, '+8920841209')

sqlerror help please [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
insert into dbo.leerlingen
('1',
'Reduan de Boer',
'postweg12',
'4589 vb',
'zelhem',
'23841')
when i type this in i get this error can anyone help me please
Msg 102, Level 15, State 1, Line 7 Incorrect syntax near ')'.
You are missing the values keyword to introduce the list of values to insert:
insert into dbo.leerlingen values('1', 'Reduan de Boer', 'postweg12', '4589 vb', 'zelhem', '23841')
--^--> here
Note that it is a good practice to enumerate the columns that you want to insert into: this makes the query easier to read to someone who does not know your table structures. Also, if new columns are added that are nullable, you don't need to modify the query.
insert into dbo.leerlingen(id, name, ...) --> enumerate all target columns here
values('1', 'Reduan de Boer', 'postweg12', '4589 vb', 'zelhem', '23841')
Finally: some of your values look like numbers - if they are, then you should not surround them with single quotes (which are typically meant for strings). This makes the intent more obvious, and avoids the need for implicit conversion on database side.

Syntax error near the keyword order [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
When I perform this query
SELECT
orders.id, orders.order - time, orders.pizza.id,
orders.pizza.type, orders.pizza-size, orders.quantity,
FROM
orders
INNER JOIN
permit ON orders.id = pizza.id
WHERE
([username] = #username)
I get an error
Syntax error near the keyword order
Any ideas how to solve this?
Since you have no order by clause and the error message is complaining about your statement near the order keyword, I surmise that there are two possibilities.
The first is that you've left the s of one of your table specifiers, using order instead of orders, despite your transcription.
The second is that orders.order-time is incorrect, being treated as orders.order - time. In fact, I'd be a little worried by many of your names, including those that have two periods (.) in them. You may want to check if the - and the subsequent . characters should be underscores (_) instead.
You also have a trailing comma after the last column selection (before the from), which is not valid SQL.
Assuming SQL-Server
SELECT orders.id, orders.[order-time], orders.[pizza.id], orders.[pizza.type], orders.[pizza-size], orders.quantity,
FROM orders INNER JOIN permit ON orders.id = pizza.id
WHERE ([username] = #username)
Remove the comma after the final column before FROM.
Also could you explain what the "> on the end is for, was this pasted in error?