I am having trouble with this simple query in oracle application express and am getting this error:
Query cannot be parsed, please check the syntax of your query.
(ORA-06502: PL/SQL: numeric or value error: character string buffer
too small)"
SELECT E.EQUIPMENTID, E.EQUIPMENTDESCRIPTION
From EQUIPMENT as E
left outer join EQUIPMENT_CHECKOUT as EC
on E.EQUIPMENTID = EC.EQUIPMENTID
WHERE EC.EQUIPMENTID is null
I think the error might be misleading in this case. You don't include AS when specifying table aliases, i.e.:
SELECT E.EQUIPMENTID, E.EQUIPMENTDESCRIPTION
From EQUIPMENT E
left outer join EQUIPMENT_CHECKOUT EC
on E.EQUIPMENTID = EC.EQUIPMENTID
WHERE EC.EQUIPMENTID is null
BTW: in Apex, you can try SQL statements in the SQL Commands window (in SQL Workshop) which usually gives better syntax error info.
Related
I'm executing a regular Oracle insert query, I don't know why this error happens, any clue?
Insert query is a bit complicated, can't paste it here
is ParamInfo893e67a5-d0ab-4489-b8b3-4f5b05dbdb3d mean that the issue is because of Guide?
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at Oracle.ManagedDataAccess.Client.OracleParameter.set_Size(Int32 value)
at ParamInfo893e67a5-d0ab-4489-b8b3-4f5b05dbdb3d(IDbCommand , Object )
I have below table dim_ethernet which has a column 5G_ON_AIR_DT
. I have to update its value from programming so I have written syntax in below style .
I got an error while running the code.
Does any one know how to write this code properly.
update ORA.dim_ethernet
set "5G_ON_AIR_DT" =: 5G_ON_AIR_DT
WHERE SITE_DWKEY =: SITE_DWKEY;
Seems like you are very new to Oracle world. Couple of things that are worth considering.
Your Query:
update ORA.dim_ethernet
set "5G_ON_AIR_DT" =: 5G_ON_AIR_DT
WHERE SITE_DWKEY =: SITE_DWKEY;
Points:
=: makes no sense as it is not valid in either SQL or PLSQL.
:= is an assignment operator in PLSQL.
= is assignment operator in SQL
PLSQL and SQL are two different engines but work together flawlessly giving an impression that they are one and the same. But in fact, they are not.
:some_val acts as a bind variable.
Using "column_name" is bad. Objects in Oracle are not case sensitive and if you put any object name inside double quotes, then it becomes case sensitive. There is no need to make your column name case sensitive.
That said, post the sample data and expected output. You will receive the best replies on the forum to handle what you are doing.
You have an identifier 5G_ON_AIR_DT.
From the Database Object Names and Qualifiers documentation:
Nonquoted identifiers must begin with an alphabetic character from your database character set. Quoted identifiers can begin with any character.
Since your identifier does not begin with an alphabetic character it cannot be used as a non-quoted identifier and always must be used with quotes.
You also have syntax errors with the =: and should be using = instead.
This would give you the query:
UPDATE ORA.dim_ethernet
SET "5G_ON_AIR_DT" = "5G_ON_AIR_DT"
WHERE SITE_DWKEY = SITE_DWKEY;
(Note: this statement will update the rows where SITE_DWKEY is not NULL and modify the 5G_ON_AIR_DT column to be its current value; so appears to be a pointless operation but would now be syntactically valid.)
db<>fiddle here
I got this error when I am trying to execute this SQL expression in Oracle APEX 5.1
select A.ENTREPRISE_RET
from A
inner join B
on A.ID_RET = B.ID_RETRAIT;
What you wrote is not a "PL/SQL Expression", but (probably) "SQL query (return single value)".
Though, are you sure that this query returns just one value? There's no WHERE clause in your query, and you can't put many rows into a single item.
Or, should I correct myself: you can, if you use "SQL query (return colon separated values)" source type. No problem in doing that - you'd use LISTAGG, for example, but the question is whether that's what you really want.
I try to use golang and query data from Oracle. My SQL query is:
SELECT * FROM TABLE1 OFFSET 10 ROWS;
But it gives an error:
EXTRA *errors.withStack=dpiStmt_execute: ORA-00933: SQL command not properly ended
My SQL query works fine when I query in SQL*Plus, but errors when I use golang.
I'd try running the query without the terminating semicolon, as Alex Poole pointed out. A lot of Oracle client libraries (i.e. cx_Oracle in python, ADO.NET Oracle Libraries) do complain if you try to execute a query ending with the semicolon (which is perfectly legal in SQL/Plus)
If the offset is not specified, it is assumed that it is 0 (zero). So, remove that clause (as it does nothing in your case), i.e.
select * from table1
and use that query in golang.
I am pretty sure that just your closing semicolon is to much. The semicolon is a character to separate several SQL statements or to close a pl/sql block. So when you write it at the end of a SQL statement the parser doesn't know how to handle it, cause he only awaits a single SQL statement.
I am trying to use convert function to convert date field to varchar but it keep giving missing expression error.
My Query:
select INVENTORY_ITEM_ID,
convert(varchar(20), IMPLEMENTATION_DATE,110)
from apps.mtl_item_revisions
where INVENTORY_ITEM_ID=21928;
gives error:
ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action: Error at Line: 97 Column: 35
The following line is Microsoft SQL Server syntax, not Oracle syntax:
convert(varchar(20), IMPLEMENTATION_DATE,110)
It doesn't matter what kind of database driver you use, or who wrote it. The query is being sent to Oracle with SQLServer syntax and Oracle is giving the error. (Also, while it might be required in a query tool, be wary of terminating oracle SQL statements with semicolon; in some languages (e.g. C#, or dynamic SQL within PL/SQL) you may get an unexpected character error.)
Change your SQL to this:
select INVENTORY_ITEM_ID,
to_char(IMPLEMENTATION_DATE, 'mm-dd-yyyy') as IMPLEMENTATION_DATE
from apps.mtl_item_revisions
where INVENTORY_ITEM_ID=21928
That's the ORacle equivalent of SQLServer 110 date format