I have a query:
SELECT * FROM table(i#1040_inv_adj_fn('123'))
how to add const value? This example doesn't work:
SELECT *, 'John' Name FROM table(i#1040_inv_adj_fn('123'))
error:
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause:
*Action:
Error at Line: 1 Column: 9
As you did not tell us what the error is we have to guess. My guess is you need an alias for the table function, otherwise the * isn't legal:
SELECT t.*,
'Name' as John
FROM table(i#1040_inv_adj_fn('123')) t
Related
Ques : How do I will select full table with "NVL()" Oracle SQL function
Code :
SELECT NVL(ORDERNO, 'AAA') * FROM GNGRB.PRBOOK;
Error :
ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action:
Error at Line: 11 Column: 30
Is this what you want?
SELECT NVL(ORDERNO, 'AAA') as NEWORDERNO, p.* FROM GNGRB.PRBOOK p;
This selects all rows and columns of the table, and adds another column, called ORDERNO, that replaces null values in ORDERNO with 'AAA'.
Note that this only works as long as ORDERNO is of a string-like datatype: both arguments of NVL() must have the same datatype.
I'm trying write an update statement that changes the passwords of customers who placed more than one
order to excellent, which contains all lowercase characters:
UPDATE customers_mgs
SET password = 'excellent'
WHERE customer_id = SELECT customer_id FROM customers_mgs WHERE count(>1 group by customer_id)
But I keep getting this error message:
Error report -
SQL Error: ORA-00936: missing expression
00936. 00000 - "missing expression"
You need parentheses around a subquery. Presumably, you also want IN rather than =:
UPDATE customers_mgs
SET password = 'excellent'
WHERE customer_id IN (SELECT customer_id
FROM customers_mgs
GROUP BY customer_id
HAVING COUNT(*) > 1
);
I was trying to use select into statement to copy contents from one table to another.
select* into xyz from xyz_123 where id = 100
but while executing I'm getting an error
ORA-00905: missing keyword
00905. 00000 - "missing keyword"
*Cause:
*Action:
Error at Line: 10 Column: 15
please help me fix this error
If table xyz already exists use this:
INSERT INTO xyz
SELECT * FROM xyz_123 WHERE id = 100
If table xyz does not yet exist, then create it:
CREATE TABLE xyz
AS SELECT * FROM xyz_123 WHERE id = 100
By the way, if you spend a little time searching Stack Overflow here, as well as one other site here, then you can piece this answer together yourself.
It is not correct syntax if you are executing it alone. Use like below.
insert into xyz
select * from xyz_123 where id = 100;
I am running a query on ORACLE DB 11g and am having an issue:
select ORDER as "_id", * from orderlines;
I have this error:
ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action:
Error at Line: 7 Column: 41
I tried it with and without the ; and still gives the error.
Thanks in advance!
As ORDER is a reserved word in many RDBMSs including Oracle, you should escape it with " :
SELECT t."ORDER" AS "_id"
, t.*
FROM "orderlines" t
This kind of query would work perfectly in SQL Server, but it does not work in Oracle.
select issueno, * from SOMETABLE;
The error message I'm getting is:
ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action: Error at Line: 1 Column: 16
What is wrong?
Try this, when working with oracle db you need alias when you use column name along with *
select issueno, A.* from SOMETABLE A;
On Oracle you have to include the table name or an alias to use the *. Try this:
select issueno, SOMETABLE.*
from SOMETABLE;