ISSUES giving invalid identifier
Hello
Under query me gives error invalid identifier.
Can someone please make an eyeball and let me know any correction on the underside of sql?
SELECT case_id
OF form_product A
WHERE ud_text_12 LIKE '% % '.
AND THERE ARE
(
SELECT case_id
OF form_product B
WHERE ud_text_12 LIKE ' % of DRUGS. "
)
AND A.CASE_ID = B.CASE_ID
SQL error: ORA-00904: "B". "" CASE_ID ": invalid identifier
00904, 00000 - '% s: invalid identifier '.
* Cause:
* Action:
Thank you
Ann
I guess you mean:
SELECT case_id
OF form_product A
WHERE ud_text_12 LIKE '% % '.
AND THERE ARE
(
SELECT case_id
OF form_product B
WHERE ud_text_12 LIKE '% DRUG' AND A.CASE_ID = B.CASE_ID
)
Tags: Database
Similar Questions
-
During execution of the query below, I get ORA-00904 as invalid identifier error.
But when I execute view inline that it gives the result.
I'm giving all types of data correctly.
Select EMP_QUERY. "' Empno ' EMPNO,. EMP_QUERY. "' Ename ' ENAME, EMP_QUERY. """" "Job", EMP_QUERY. "" Bishop "MGR. EMP_QUERY. "" HireDate "HIREDATE. EMP_QUERY. "' SAL ' SAL, EMP_QUERY. "Comm"COMM, EMP_QUERY. "DEPTNO"DEPTNO ". Of ( Select empno, ename, job, mgr, Hiredate, sal, comm, deptno SRC_1.EMP_SRC_11
) EMP_QUERY
where (1 = 1) That's because you specified the column name in the selection external double quotes.
EMP_QUERY. "' Empno ' EMPNO
Why does. To take
emp_query.EmpNo as 'Empno '.
-
Subselect query returns "invalid identifier", but the nested query return lines
I don't think it's a general SQL question.
Select * from persons where person_id in)
Select person_id with people whose name = 'Obama' - subquery
) and age > 18;
When I run the subquery, I get:
ORA-00904: "PERSON_ID": invalid identifier
00904, 00000 - '% s: invalid identifier '.
* Cause:
* Action:
Error on line: column 5: 8
This is because the table people do not have the person_id field.
But when I run the nested together query it returns all the lines in people with the AGE greater than 18.
How is he succeeds when the subquery is obviously wrong?
363f652b-263D-4418-933F-74a1d0a41b4c wrote:
I don't think it's a general SQL question.
Select * from persons where person_id in)
Select person_id with people whose name = 'Obama' - subquery
) and age > 18;
When I run the subquery, I get:
ORA-00904: "PERSON_ID": invalid identifier
00904, 00000 - '% s: invalid identifier '.
* Cause:
* Action:
Error on line: column 5: 8
This is because the table people do not have the person_id field.
But when I run the nested together query it returns all the lines in people with the AGE greater than 18.
How is he succeeds when the subquery is obviously wrong?
Yes - this is a general SQL question and ask often enough.
Correlated subqueries depend on the inner query, be able to see and access to the columns of the outer query. Normally see you referenced in the WHERE clause of the subquery and not in the SELECT clause, but the reference is valid in both places. This works because the columns of the tables in the main query are accessible in the subquery. "Person_id" is probably a column in the table 'people '.
Which can be a cause of problems 'odd' when the column (in your case "person_id") is more of a table.
Use an alias in the subquery in the subquery and you will find that it will not succeed.
See these two articles AskTom where he addresses this specific issue
http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:3317493900346468494
http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:155200640564
-
Suspended blackBerry smartphones. Reason: 116 - invalid identifier
Hello everyone,
I hope someone here can help me.
My Blackberry Curve stopped receives or sends data communications last night. My provider (Rogers) service troubleshooting-the question down to the RIM servers. Rogers stated that they could not access the envirnoment RIM to fix this and they gave me a phone number. 1 800 327 - 9085
Looks like I have to pay for a support call to get my Blackberry restored. It's obviously ridiculous since it was no fault of mine that this problem has occurred.
Error message: Suspended. Reason: 116 - invalid identifier
How can I solve this?
Thank you
Reminder of Rogers and ask (ask politely) that your question be wound to RIM tech support level, free of charge. They will do it. There is no reason for you to pay for per-incident support.
Rogers wouldn't you give no reason for the suspension?
Which has been suspended, your Rogers account, your PIN, your what?
-
ORA-00904: "DATA". "" AM ": invalid identifier
Hello
I am facing upwards a situation I can't find why is the error ora-00904 appears.
I wrote the request as follows:(A)
with data as ( select uc.* from user_computer uc where computer_name like '%'||:perioxi||'%' ) select uc.* from user_computer uc where exists (select 1 from data where data.am = uc.am) and exists (select 1 from v_misthotoi_orga where uc.am = v_misthotoi_orga.matr)
Where the utilisateur_ordinateur is a table, and the v_misthotoi_orga is a db view (a view that is based on another view that is based on a table that is accessed through a dblink).
A query runs without error.(B)
with data as ( select uc.* from user_computer uc where computer_name like '%'||:perioxi||'%' ) select uc.* from user_computer uc where exists (select 1 from data where data.am = uc.am) <.... THE DATACOLUMN DATA.AM IS USED, WITHOUT ERROR and exists (select 1 from v_misthotoi_orga where data.am = v_misthotoi_orga.matr) <.....THIS IS WHERE THE ERROR IS LOCATED (DATA.AM)
The above query (application B) stops with error: ORA-00904: "DATA". "" AM ": invalid identifier.
You can identify the cause of the error, since the datacolumn 'am' in 'data' datasource is used twice in query B.
In the first instance without any error in the second with the error.Note: Oracle db v.2
Thank you
SIMHey Sim,
Change
select 1 from v_misthotoi_orga where data.am = v_misthotoi_orga.matr
TO
select 1 from v_misthotoi_orga, data where data.am = v_misthotoi_orga.matr
In this query, Oracle knows no data unless you specify in the From clause that he should use.
HTH,
Stefan
-
ORA-00904: "ORA_ROWSCN": invalid identifier
Get this error when trying to open tables in SQL Developer and data display.
ORA-00904: "ORA_ROWSCN": invalid identifier
Found a very old thread talking about this error, and now it's happening with me with SQL Developer Version on a Mac/Yosemite 4.1.1.19.
https://community.Oracle.com/thread/1019844
It happened for awhile and I didn't say anything because I can run a select statement * and get all the data I need. But it is bit boring so wonder if it's a bug that's resurfaced? Anyone else seeing this? Apparently not, because there seems to be no recent discussions on this subject, but maybe I'm not find them.
Earl
References to the built-in ORA_ROWSCN function should not return the message "invalid identifier" when connected to Oracle 10 g R1 or higher. When you connect to a pre - 10 g R1, uncheck the box use ORA_ROWSCN for DataEditor insert and update statements in Tools > Preferences > Database > Object Viewerr.
Edit:
Oracle 10 g or higher, tables with a policy defined on them will know it: ORA-00904: 'ORA_ROWSCN': invalid makes unusable 2.1.0.63 output
Edit2:
More information, if you wish: using ora_rowscn on a table FGAC: bug?
-
SQL Error: Invalid identifier ORA-00904
Hello
The Version of SQL Developer: 11g
Two tables: nav_vendors (source), vendor (destination)
Both having 16 'Same' columns (data will differ for some records of... for some data records are same to check the process DML works according to the need).
I'm trying to insert update and delete using merge operation
I m getting error below whenever I tried to merge them. All column names are the same in the table.
SQL error: ORA-00904: "S". "" COMPANY_CODE ": invalid identifier
SQL:
MERGE INTO s source
USING (nvl (d.VENDOR, s.VENDOR) selection of the SELLER,
NVL (d.Name, s.Name) NAME.
NVL (d.NAME3, s.NAME3) Name3,
NVL (d.ADDRESS1, s.ADDRESS1) address1.
NVL (d.DISTRICT, s.DISTRICT) DISTRICT.
NVL (d.CITY, s.CITY), CITY,
NVL (d.Country, s.Country) COUNTRIES.
NVL (d.Postcode, s.Postcode) ZIP Code,
NVL (d.TELEPHONE, s.TELEPHONE), PHONE,.
NVL (d.Fax, s.Fax) FAX.
NVL (d.contact, s.contact) CONTACT.
NVL (d.URL, s.URL) URL.
NVL (d.email, s.email) EMAIL.
NVL (d.DELIVERY_TOLERANCE, s.DELIVERY_TOLERANCE) DELIVERY_TOLERANCE.
NVL (d.EXCLUDE_REWORK_TEXT, s.EXCLUDE_REWORK_TEXT) EXCLUDE_REWORK_TEXT.
NVL (d.COMPANY_CODE, s.COMPANY_CODE) COMPANY_CODE.
(case
When ((d.VENDOR = s.VENDOR)
and (d.NAME = s.NAME)
and (d.NAME3 = s.NAME3)
and (d.ADDRESS1 = s.ADDRESS1)
and (d.DISTRICT = s.DISTRICT)
and (d.CITY = s.CITY)
and (d.COUNTRY = s.COUNTRY)
and (d.POSTCODE = s.POSTCODE)
and (d.TELEPHONE = s.TELEPHONE)
and (d.FAX = s.FAX)
and (d.CONTACT = s.CONTACT)
and (d.URL = s.URL)
and (d.EMAIL = s.EMAIL)
and (d.DELIVERY_TOLERANCE = s.DELIVERY_TOLERANCE)
and (d.EXCLUDE_REWORK_TEXT = s.EXCLUDE_REWORK_TEXT)
and (d.COMPANY_CODE = s.COMPANY_CODE))
then "correspondence".
When d.COMPANY_CODE is null
then 'DELETE '.
When s.COMPANY_CODE is null
then "INSERT."
on the other
"no match."
chck end)
of s nav_vendorz
full outer join of the seller d
On(d.COMPANY_CODE=s.COMPANY_CODE)
) d
(S.COMPANY_CODE = d.COMPANY_CODE AND (in d.chck ("not matched", 'match', 'DELETE')))
WHEN MATCHED THEN
->UPDATE SET s.company_code = d.company_code <-error line
WHERE in d.chck ("not matched", "DELETE")
DELETE WHERE d.chck = 'DELETE '.
WHEN NOT MATCHED THEN
INSERT (VENDOR, NAME, ADDRESS1, NAME3, NEIGHBORHOOD, CITY, COUNTRY, CODE POSTAL, PHONE, FAX, CONTACT, URL, EMAIL, DELIVERY_TOLERANCE, EXCLUDE_REWORK_TEXT, COMPANY_CODE)
VALUES
(d.VENDOR, d.NAME, d.NAME3, d.ADDRESS1, d.DISTRICT, d.CITY, d.COUNTRY, d.POSTCODE, d.TELEPHONE, d.FAX, d.CONTACT, d.URL, d.EMAIL, d.DELIVERY_TOLERANCE,d.EXCLUDE_REWORK_TEXT,d.COMPANY_CODE);/
(1) use different alias names
(2) do not try to update a column that is used to 'ON' clause.
-
ORA-00904: invalid identifier
Hi all
I'm getting ORA-00904: "SNO_T": invalid identifier will be done in this example. Please let me know where I have error.
create table t4(name varchar2(22),sno number); insert into t4 values('suman2',2); insert into t4 values('suman',1); create or replace type t4_t as object( name_t varchar2(22), sno_t number ); create or replace type t4_m is table of t4_t; / declare l_toys t4_m; l1 pls_integer; begin select t4_t(name_t,sno_t) bulk collect into l_toys from t4; -- DBMS_OUTPUT.PUT_line(l_toys.count); select count(*) into l1 from t4; DBMS_OUTPUT.PUT_line(l1); end; Error report - ORA-06550: line 5, column 21: PL/SQL: ORA-00904: "SNO_T": invalid identifier ORA-06550: line 5, column 2: PL/SQL: SQL Statement ignored 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:
Select t4_t (name_t, sno_t)
bulk collect into l_toys
T4;
the columns in your table are called name and sno, so you must use these names in your select statement
t4_t is the manufacturer that expects two values (a string and a number) and having built an object, you will be able to access the object by using object_name.sno_t, but do not all by building this...
HTH
-
ORA-00904: "YYYY": invalid identifier using impdp
Hello
I am trying to import a part of a table to another table on the remote database using impdp:
Impdp directory of centrumadmin/centrumadmin = network_link DUMP_LOG_DIRECTORY LOGFILE = backup_2014_01.log = REF2ISKNE = 'AUD$ _BACKUP' content TABLES = QUERY DATA_ONLY =------"WHERE \" NTIMESTAMP # "> to_date\ (January 2, 2014","DD-MM-YYYY '------") "------"; "
But still get this error:
Start "CENTRUMADMIN". "' SYS_IMPORT_TABLE_01 ': centrumadmin / * directory = network_link DUMP_LOG_DIRECTORY LOGFILE = backup_2014_01.log = REF2ISKNE TABLES = AUD$ happy _BACKUP = DATA_ONLY QUERY =" WHERE NTIMESTAMP # > to_date (02-2014, MM-YYYY) ""
Current estimation using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 4,473 GB
ORA-31693: Data Table object 'CENTRUMADMIN '. "" AUD$ _BACKUP "could not load/unload and being ignored because of the error:
ORA-00904: "YYYY": invalid identifier
Work "CENTRUMADMIN". "" SYS_IMPORT_TABLE_01 "completed with error (s 1) to Wed Feb 11 09:32:15 2015 elapsed 0 00:00:03
Any ideas? If I change the date format YYYY-MM-DD or the other, always error is in the last part: ORA-00904: "DD": invalid identifier.
Thank you.
Honza
Hi Mika,
have you played around with some double 'or triple?
as
to_date\ ("02/01/2014","DD-MM-YYYY"------)-«;»
concerning
Kay
-
ORA-00904: "PCT_DB_TIME": invalid identifier
Hello
on 11.2.0.4 on Win 2008
I got when running:
SQL > SELECT EVENT, n.WAIT_CLASS,.
TIME_WAITED_MICRO, ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) 2 PCT_DB_TIME
3. IN V$ SYSTEM_EVENT E, V$ EVENT_NAME N,.
4 (SELECT the DBTIME OF the V VALUE $ SYS_TIME_MODEL WHERE STAT_NAME = 'DB time') S
5. WHERE E.EVENT_ID = N.EVENT_ID
6 AND N.WAIT_CLASS NOT IN ('inactive', ' E/s system') and PCT_DB_TIME <>0
7 ORDER BY PCT_DB_TIME ASC;
AND N.WAIT_CLASS NOT IN ('inactive', ' E/s system') and PCT_DB_TIME <>0
*
ERROR on line 6:
ORA-00904: "PCT_DB_TIME": invalid identifier
Thanks for the help.
This is an invalid identifier because you cannot use a column assigned in the application to the location alias WHERE clause or ORDER BY in the same query. You have two options to rewrite this query:
SELECT EVENT, n.WAIT_CLASS,
TIME_WAITED_MICRO, ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) PCT_DB_TIME
V $ SYSTEM_EVENT E, V$ EVENT_NAME N,.
(SELECT the DBTIME VALUE OF V$ SYS_TIME_MODEL WHERE STAT_NAME = "DB time") S
WHERE E.EVENT_ID = N.EVENT_ID
AND N.WAIT_CLASS NOT IN ('Idle', ' E/s system') and ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) <> 0
ORDER BY ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) ASC;and
SELECT * from
(SELECT EVENT, n.WAIT_CLASS,
TIME_WAITED_MICRO, ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) PCT_DB_TIME
V $ SYSTEM_EVENT E, V$ EVENT_NAME N,.
(SELECT the DBTIME VALUE OF V$ SYS_TIME_MODEL WHERE STAT_NAME = "DB time") S
WHERE E.EVENT_ID = N.EVENT_ID
AND N.WAIT_CLASS NOT IN ('Idle', ' E/s system'))
where PCT_DB_TIME <> 0
ORDER BY PCT_DB_TIME ASC;Both work.
David Fitzjarrell
-
ORA 00904: invalid identifier "JAN".
Hello
I have the rest of the table.
===========================================
create table ATT_ATTENDANCESHEET as
(
Select 1 empid, to_date('21/01/2014','dd/mm/yyyy') prdate, 240 reg, 0 unpaid all double union
Select 2, to_date (January 21, 2014 ', ' dd/mm/yyyy'), 200 reg, 0 unpaid all double union
Select 3, to_date (January 21, 2014 ', ' dd/mm/yyyy'), 240 reg, 0 unpaid all double union
Select option 4, to_date (January 21, 2014 ', ' dd/mm/yyyy'), 480 reg, 0 unpaid all double union
Select 5, to_date (January 21, 2014 ', ' dd/mm/yyyy'), 240 reg, unpaid double 0
);
=================================================
I want to remove rows from table ATT_ATTENDANCESHEET.
If the parameter passed empids, lines for employees would be eliminated.
If empids is null, all records between the given period will be deleted.
I created after the procedure to that effect.
------------------------------------------------------
CREATE or replace FUNCTION deleteAttendanceDetails (startdate DATE, enddate DATE, empids varchar2) RETURN NUMBER as
n number;
condition varchar2 (200);
vsql varchar2 (2000);
BEGIN
IF empids is not null
THEN
condition: condition = |' and empid in ('| empids |') ' ;
END IF;
vsql: =' delete from ATT_ATTENDANCESHEET where prdate between ' | StartDate | 'and' | EndDate | condition;
EXECUTE IMMEDIATE (vsql);
return n;
END;
/
The empids parameter contains the employee IDS separated by commas.
for example
"1,2,3,4"
-----------------------------------------------------------
But when I call this function using
Select deleteAttendanceDetails (to_date('25/01/2014','dd/mm/yyyy'), to_date (' 01/31/2014 ',' dd/mm/yyyy'), ") double;
I get the following error
ORA 00904: invalid identifier "JAN".
ORA-06512: at.. .line 21
I use oracle 10g.
Help, please
Do not use dynamic sql. It's more trouble that it's worth.
Your error comes from the fact that you convert a date to a string, implicitly and then come back.
In addition, your example doesn't have a field of prddate... so I added that, in my test table so that it works.
Try something like that, entirely avoid dynamic sql:
CREATE or replace FUNCTION deleteAttendanceDetails ( startdate DATE, enddate DATE, empids varchar2 ) RETURN NUMBER as n number; BEGIN delete from ATT_ATTENDANCESHEET where ( empid IS NULL OR empid in ( select regexp_substr ( empids, '[^,]+', 1, level) empid from dual connect by level <= (LENGTH(empids) - LENGTH(REPLACE(empids, ',')) + 1) ) ) and prdate between nvl(startdate, to_date('01-jan-1900','dd-mon-yyyy')) and nvl(enddate , to_date('01-jan-5000','dd-mon-yyyy')); return n; -- what is "n" ? END; /
Not really sure what you want to do with "n"... you have nothing in your code... so I did the same
-
PL/SQL: ORA-00904: invalid identifier
Hello
Run the script after and encountered the error.
SQL > create or replace FUNCTION p_CQTicketUsu
() 2
3 v_TicketUserID IN NUMBER by DEFAULT NULL,-it's the [CQTicketUsers]. TicketUserID generated on update
4 v_TicketID IN NUMBER by DEFAULT NULL,-it's the [CQTicketUsers]. TicketID update
5 v_AdminUserID IN NUMBER by DEFAULT NULL,-it's the [CQTicketUsers]. AdminUserID update
6 v_TicketUserTypeID IN NUMBER by DEFAULT NULL - this is the [CQTicketUsers]. TicketUserTypeID update
7)
8 RETURN NUMBER
9, ACCORDING TO
10 v_sys_error NUMBER: = 0;
11 v_ERRSQL NUMBER (10,0);
12 v_UpdCount NUMBER (10,0);
13
BEGIN 14
15
16 UPDATE CQTicketUsers
17 SET v_TicketUserID = TicketUserID,
18 v_TicketID = TicketID,
19 v_AdminUserID = AdminUserID,
20 v_TicketUserTypeID = TicketUserTypeID
21 WHERE TicketUserID = v_TicketUserID;
22 v_ErrSQl: = v_sys_error;
23 v_UpdCount: = SQL % ROWCOUNT;
24 IF v_ErrSQL <>0 THEN
25 RETURN-1;
26 END IF;
27 IF v_Updcount < 1 THEN
28 RETURN - 2;
29 END IF;
30 RETURN 0;
ENDS 31;
32.
WARNING: Function created with compilation errors.
SQL > show error
Errors for the P_CQTICKETUSU FUNCTION:
16/4 PL/SQL: statement ignored
20/11 PL/SQL: ORA-00904: "V_TICKETUSERTYPEID": invalid identifier
Please note, I said v_TicketUserTypeID to the #6 line. Advice kindly.
Kind regards
Ballanger
It's going to be kind of embarrassing, but you have the update parameters reversed. It should be
TicketUserTypeID = v_TicketUserTypeID
and is not
v_TicketUserTypeID = TicketUserTypeID
You get this error for database columns not only for pl/sql variables.
-
FDMEE failed to import - ORA-00904: "CHECK_FLAG": invalid identifier
We get this error when importing data from BSE. We use 11.1.2.3.00. Any help would be appreciated.
< errorMessage > <! [CDATA [ODI-1226: p_bal_check_flag step fails after 1 attempt.]]
ODI-1228: P_bal_check_flag (Variable) of the task fails when you connect target FDMEE_DATA_SERVER.
Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "CHECK_FLAG": invalid identifier
We have re-imported importing files & data scenario worked. Trying to find how the scenario files has been changed.
Thank you
-
"ORA-00904 of invalid identifier", what's the problem?
Hey,.
I am trying to create very basic (via Script Editor) 4 tables in Application Express 4.1.0.00.32 and get this error and cannot understand why. If anyone can point out where I am going wrong would be perfect!
Here's the script:
----------
Drop TABLE County CASCADE CONSTRAINTS ;
Drop TABLE City CASCADE CONSTRAINTS ;
Drop TABLE Offence CASCADE CONSTRAINTS ;
Drop TABLE Region CASCADE CONSTRAINTS ;
CREATE TABLE County (
PRIMARY County_Name VARCHAR2()55) KEY
Rental VARCHAR2 (55) ,
Details VARCHAR2 (222) );
CREATE TABLE Offence (
Offence_ID NUMBER (3) PRIMARY KEY ,
Offence_Desc VARCHAR2()333)
Offence_Type VARCHAR2()111() NOT NULL
Date DATE NOT NULL ,
Time NUMBER (5) ,
County_Name VARCHAR2()55( ) REFERENCES County()County_Name)
City_Name VARCHAR2()55( ) REFERENCES City()short-term()
Region_Name VARCHAR2()55( ) REFERENCES region()rated()()
CREATE TABLE City (
County_Name VARCHAR2()55( ) REFERENCES County()County_Name)
PRIMARY City_Name VARCHAR2()55) KEY
PostCode VARCHAR (8) NOT NULL ,
House # NUMBER (3) NOT NULL ,
Street VARCHAR2 (55) ,
Town VARCHAR2 (55) ,
Building_Name VARCHAR2 (55) );
CREATE TABLE Region (
PRIMARY Region_Name VARCHAR2()55) KEY
City VARCHAR2 (55) NOT NULL ,
Est_Population NUMBER (9) NOT NULL );
-----------
The error I get in the summary when I run the script is:
6 «» 0.00 CREATE TABLE offence (Offence_ID NUMBER PRIMARY KEY (3),) "ORA-00904: invalid identifier. So I guess it's related to the "Offence_ID" line (designed as the primary key / identifier), but I don't see a problem.
Any help is greatly appreciated!
The DATE is an Oracle reserved word.
Oracle reserved words and keywords
SQL > create table test_tbl
() 2
3 date default sysdate
4 );
date default sysdate
*
ERROR at line 3:
ORA-00904: invalid identifier
SQL > create table test_tbl
() 2
3 'DATE' date default sysdate
4 );
Table created.
I wouldn't recommend do not name your DATE column, but to use something like Offence_date instead.
-
java.sql.SQLSyntaxErrorException: ORA-00904: invalid identifier
Hi all
IM using JDeveloper 11.1.1.6.0.
Here, I said method in the main class, which returns an object of type of connection reference.
When I run the app I type 'ksh' in the fields and click on submit.
It shows the following error, java.sql.SQLException: ORA-00904: "KSH": invalid identifier
{code}
public static list < privileges > getUserPrivileges (DBTransaction dbt, object userId)
{
String sql = "SELECT m.menu_code" +.
"OF sec_menus m p sec_menu_privileges JOIN +.
"WE (m.menu_code = p.menu_code '+)"
"(ET m.app_id = p.app_id)" + "
"JOIN sec_user_app_groups g +.
"WE (g.GROUP_ID = p.GROUP_ID '+)"
"AND p.app_id = g.app_id" +.
"AND user_id =" + userId + "."
" )";
PreparedStatement stat = null;
ResultSet rs = null;
List of privileges <>privilegesList = new ArrayList < privileges > ();
MenuCode string = "";
Try
{
= stat dbt.createPreparedStatement (sql, 1);
RS = stat.executeQuery ();
While (RS. Next())
{
menuCode = rs.getString (1);
}
}
catch (System.Exception e)
{
e.printStackTrace ();
}
Finally
{
closeStatement (stat);
closeResultSet (SR);
}
Return privilegesList;
}
Public Shared Sub closeStatement (stat of statement)
{
Try
{
STAT. Close();
}
catch (SQLException e)
{
}
}
public static void closeResultSet (ResultSet rs)
{
Try
{
RS. Close();
}
catch (SQLException e)
{
}
}
------------
CREATE TABLE SEC_USERS
(
USER_ID VARCHAR2 (10),
USER_NAME VARCHAR2 (50).
PASSWORD VARCHAR2 (300)
)
Insert into SEC_USERS
(USER_ID, USER_NAME, USER_FIRST_NAME, USER_LAST_NAME, PASSWORD)
Values
('ksh', 'ksh', 'test');
COMMIT;
-----------------------
Error:
java.sql.SQLSyntaxErrorException: ORA-00904: "KSH": invalid identifier
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:947)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1283)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1441)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3823)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1671)
dry. ControllerUtil.getUserPrivileges (ControllerUtil.java:90)
dry. ControllerUtil.login (ControllerUtil.java:59)
at sec.model.AppModuleImpl.login(AppModuleImpl.java:77)
at sec.control.bean.LoginPage.loginAction(LoginPage.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke (unknown Source)
at com.sun.el.MethodExpressionImpl.invoke (unknown Source)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:889)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:379)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run (StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:446)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:446)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged (Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.wrapRun (WebAppServletContext.java:3715)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
< ActionListenerImpl > < processAction > java.lang.NullPointerException
javax.faces.el.EvaluationException: java.lang.NullPointerException
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:889)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:379)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run (StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:446)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:446)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged (Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.wrapRun (WebAppServletContext.java:3715)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.NullPointerException
dry. ControllerUtil.closeResultSet (ControllerUtil.java:136)
dry. ControllerUtil.getUserPrivileges (ControllerUtil.java:118)
dry. ControllerUtil.login (ControllerUtil.java:59)
at sec.model.AppModuleImpl.login(AppModuleImpl.java:77)
at sec.control.bean.LoginPage.loginAction(LoginPage.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke (unknown Source)
at com.sun.el.MethodExpressionImpl.invoke (unknown Source)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
... more than 54
{\code}
Thanks in advance
The particular error that causes the ORA-00904 exception, it's that you concatenate a string literal in the SQL statement without enclosing the literal with quotes. Replace the line
"AND user_id =" + userId + "."
with
"AND user_id = '" + Userid + "'" +.
Although it will work in this way, the concatenation of literal values variable to a SQL statement is a very wrong approach. The right approach is to use a placeholder variable (for example?) in the SQL statement and to link it with the necessary value after analysis of the declaration and before running. In this way, you will be able to analyze the statement once and execute it several times with different values without new analysis view the statement. Also, the SQL engine will be able to use its SQL cache if you try to analyze the statement even once again, which will significantly improve performance. However, if you concatenate variable literal value to education, engine SQL won't recognize the statement as one already analyzed, it will not use its cache and it will analyze the statement again from scratch. From a point of view shortly, the best approach is as follows:
"" AND user_id =? ".
and then
= stat dbt.createPreparedStatement (sql, 1);
stat.setString (1, userId); Don't forget to change the username to a string type in the method declaration
RS = stat.executeQuery ();
There are other problems in your code. First of all, the invocation closeResultSet (rs) after closeStatement (stat) is erroneous and obsolete, because when you close a SQLStatement instance it automatically closes all its result sets. Secondly, in the finally block you call closeStatement (stat), but there is no guarantee that stat variable is not null. For example, the variable stat can be null if the SQLStatement instance has not been established successfully in the try section above.
Dimitar
Maybe you are looking for
-
Its Qosmio X 770 is crackly and distorted
Hello What I listen to, whether it's music or sounds dialogue crackles and almost stops and doesn't seem to work properly. I don't know if it of because of one of my settings and easily attaches or should I take? Any help would be greatly appreciated
-
After a computer crash, I reinstalled Windows XP, but Windows Media Player does not work. I don't have reinstall all disks. Will install tools software system Dell, Sonic RecordNow, Sound Blaster Live, or CyberLink Power DVD play cd possible? Thank y
-
more details... Updated story was after WinDef last updated to date. Today I got option for several optional updates and a recommended... to download. I have updates notify the value. I was able to hide updates. Then poof update history was histo
-
I want to secure my wireless internet, people outside of my house
I have 2 game devices in my house I want to allow access to the internet
-
I recover a QList from 2 of the objects in the database and you want to access in QML. To do this, I registered the type: qmlRegisterType("com.class2", 1, 0, "Class2"); In addition, my class of database is published in qml: qml->setContextProperty("p