ORA-00904 - invalid identifier when adding new column to the report query
Hi,
I am trying to add a new field to an existing bespoke report query. When I click on ok, I get the following error
message: "ORA-00904: <field name> : invalid identifier ==> <field_name>
Any ideas what is causing this problem? Version of the report builder is : 6.0.8 and is connected to a 10.2 db.
Any help appreciated.
Many Thanks,
Praveen
Edited by: praveenrn on May 21, 2009 2:38 PM
What is the field name ? Maybe a reserved word ? Change to "my_new_variable" to check...
Cheers,
Jens Rettig
Similar Messages
-
Hi everyone,
has anyone else had this error which has been driving me round the bend during the last three days?
I have an interactive report which used to work fine.
Now it happens (when the page loads/a filter is en- or disabled) that - from time to time, but unpredictable - I receive
ORA-20001: get_dbms_sql_cursor error ORA-00904: : invalid identifier
The report is based on a table function.
I will try to set up a testcase and post the link here, but so far I haven't managed to force the error to occur.
But maybe someone else has already bumped into this kind of error? I would be grateful for any hints!
Best regards,
Sabine
Application Express 4.1.0.00.32
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionHi Jari,
I changed the type definition (the return type of the table function) and extended the select list in the source of the IR.
I do not use 'select *' but reference every column explicitly. So APEX easked me whether to add the new column.
I also tried deleting in recreating the region, but no luck.
Any more ideas?
Best regards,
Sabine -
Advanced Conditions causing ORA-00904 invalid identifier
I have another weird thing going on...
It may be the complexity of the data I'm pulling, but I'm going to simplify the problem first...
I have several conditions in my workbook that I need to be true regardless then I need the following (this is a payroll thing):
((Total Regular Hours > 40 AND Total Overtime = 0) OR (Total Overtime > 0 AND (Total Regular Hours - Total Overtime Hours) <> 40))
So, I'm using Discoverer Plus 10g and if I create separate conditions for Total Overtime > 0 and (Total Regular Hours - Total Overtime Hours) <> 40) it will work, but if I try to combine them into one condition (so I can then add my OR and the other 2 conditions) it gives me the "ORA-00904 invalid identifier" error and will not run.
The only way I've been able to do it is to create 3 conditions and 2 worksheets. That way, I can add (Total Regular Hours > 40 AND Total Overtime = 0) in one condition and apply it to one sheet; then I the other 2 separate conditions can be applied to the other worksheet.
I hate having to have 2 worksheets when I should be able to create an advanced condition... anyone have any ideas?
Regards,
EmilyIt is actually a typo in the message because I have a calculated column that calculates the difference... sorry.
I did try the idea of running the SQL that was generated in SQL Developer and it doesn't look right.
It did all my other conditions under the where, but then where I would have thought it should do another and it did a WHERE.... see below. (I only pasted from the from statement on to save room)
FROM HRBG_PEOPLE_ASSIGNMENT o393615, APPS.PTEN_PAY_BEE_V o393616
WHERE ( (o393616.ASSIGNMENT_ID = o393615.ASSIGNMENT_ID))
AND (o393615.BG_SECURITY_FLAG_CODE = 'Y')
AND (o393616.DATE_EARNED BETWEEN o393615.ASSIGNMENT_START_DATE AND o393615.ASSIGNMENT_END_DATE AND o393616.DATE_EARNED BETWEEN o393615.RECORD_START_DATE AND o393615.RECORD_END_DATE)
AND (o393616.DATE_EARNED IN (:"Date Earned Dates"))
AND (o393616.EFFECTIVE_DATE = :"Period End Date")))))
WHERE ( ( NP100 ) > 40 AND ( NP101 ) = 0)
AND ( ( NP104 ) <> 40 AND ( NP105 ) > 0)
ORDER BY E393849 ASC ;
Do you see the WHERE that I marked in BOLD? That should be an AND...
I even tried creating one crazy long condition to include everything in one and still got the same error and it produced the same SQL. I am thinking it has to do with the fact that I'm actually showing group totals for Regular Hours and Overtime and then subtracting them to get the difference. It all breaks when I add that difference in with the others. If I keep it separate, it does fine.
By the way, the error I get when running just the SQL is "not all variables bound"
Thanks,
Emily -
Discoverer report :ORA -00904 Invalid Identifier
Hi ,
we are using an apps mode EUL (version4i) ,
in the business area "Account Receivables"--->Customer Transaction Lines Folder,
when we pull up any item from this folder to create a report, it shows a
"ORA-00904 Invalid Identifier " error
how to fix it , whether the Item might be Deleted in view definition of this folder,
just a refresh of the folder is enough ?
thanks in advanceHi,
Refreshing the folder should be your first step.
Rod West -
Internal SYS_OP_ATG function generates "ORA-00904: : invalid identifier"
After gathering system statistics a MERGE statement within a PLSQL block now always raises "ORA-00904: : invalid identifier". Investigation points to internal SQL executed by the CBO using the SYS_OP_ATG function to be the culprit. What is this function and why does it raise "ORA-00904: : invalid identifier"? As a temporary solution deleting system statistics has made the problem disappear. My concern is that it will reappear.
Merge statement is within a procedure within a package. Nothing had been re-compiled. System statistics were gathered then the following statement errors every time. There is an exception handler around it which raises the "ORA-00904: : invalid identifier". Delete system stats and it all works fine again:
MERGE INTO lp_data lp
USING (
SELECT
f.ubimsg_id ubimsg_id,
f.endpoint_id endpoint_id,
f.msg_created_date msg_created_date,
t.end_time end_time,
DECODE(t.units_used,255,0, t.units_used) units_used,
DECODE(t.units_used,255,'N', 'Y') reading_received
FROM TABLE (CAST (tab_lp_values AS load_profiles)) t,
(SELECT ubirec.ubimsg_id ubimsg_id ,ubirec.endpoint_id endpoint_id, ubirec.msg_created_date msg_created_date FROM dual) f
) lp_rec
on (lp.endpoint_id = lp_rec.endpoint_id
and lp.end_time = lp_rec.end_time)
when matched then
update set lp.entry_date = lp_rec.msg_created_date,
lp.ubimsg_id = lp_rec.ubimsg_id,
lp.units_used = lp_rec.units_used / 10,
lp.reading_received = lp_rec.reading_received
when not matched then
insert (lp.endpoint_id,
lp.end_time,
lp.entry_date,
lp.ubimsg_id,
lp.units_used,
lp.reading_received)
values (lp_rec.endpoint_id,
lp_rec.end_time,
lp_rec.msg_created_date,
lp_rec.ubimsg_id,
lp_rec.units_used / 10,
lp_rec.reading_received );
The line FROM TABLE (CAST (tab_lp_values AS load_profiles)) t casts a plsql object collection. An SQL trace showed the following SQL which must be internal SQL generated for the MERGE statement.
SELECT distinct TBL$OR$IDX$PART$NUM("LP_DATA", 0, 1, 0, "END_TIME") FROM
(SELECT "LP_REC"."END_TIME" "END_TIME" FROM (SELECT :B1 "UBIMSG_ID",:B2 "ENDPOINT_ID",:B3 "MSG_CREATED_DATE",
SYS_OP_ATG(VALUE(KOKBF$),1,2,2) "END_TIME",
DECODE(SYS_OP_ATG(VALUE(KOKBF$),2,3,2),255,0,SYS_OP_ATG(VALUE(KOKBF$),2,3,2)) "UNITS_USED",
DECODE(SYS_OP_ATG(VALUE(KOKBF$),2,3,2),255,'N','Y') "READING_RECEIVED"
FROM TABLE(CAST(:B4 AS "LOAD_PROFILES") ) "KOKBF$","SYS"."DUAL" "DUAL") "LP_REC") ORDER BY 1
Without system statistics the trace did not have this statement in it, and the explain plan for the MERGE differed.
Oracle 11.1.0.7.0 Windows 32-BIT.
select * from v$version;
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 32-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
SQL> show parameter compatible
compatible string 11.1.0.0.0
Any help to explain / resolve this issue would be much appreciated.Duplicate thread: CBO on 11G generates ORA-00904 with SYS_OP_ATG
-
Why do I get a "DATE1 : ORA-00904 Invalid identifier" error ?
Hi,
Despite my efforts, I can't see why I get a "DATE1 : ORA-00904 Invalid identifier' error whith this request.
{code}With S1 as (
SELECT TRUNC(DATE1, 'MM'),
ROUND(SUM(VALEUR), 2)
FROM EVV_E036
GROUP BY TRUNC(DATE1, 'MM')
ORDER BY TRUNC(DATE1, 'MM'))
SELECT n,
NVL(ROUND(SUM(Valeur),2), 0)
FROM (select add_months(to_date('01/01/2006', 'dd/mm/yyyy'), level - 1) n FROM dual connect by level <= 12) months
LEFT JOIN S1
ON months.n = TRUNC(DATE1, 'MM')
GROUP BY n
ORDER BY n{code}
The line in error is this one : {code}ON months.n = TRUNC(DATE1, 'MM'){code}
Any idea much appreciated !
Regards,
Christianhi,
I have done this and get no more errors. Now I see that the values I get are equal to 0. Or, I do get values different from 0 in my table ! I can't see why the left join gives 0. I have to dig this and come back tomorrow.
With S1 as (
SELECT TRUNC(DATE1, 'MM') Date1,
ROUND(SUM(VALEUR), 2) Debit
FROM EVV_E036
WHERE CLEF_VAR = (SELECT CLEF_VAR FROM SITE_ECHELLE WHERE SITE = 'E036')
AND DATE1 BETWEEN TO_DATE ('01/01/2007000000', 'DD/MM/YYYYHH24MISS') AND TO_DATE ('31/12/2007235959', 'DD/MM/YYYYHH24MISS')
GROUP BY TRUNC(DATE1, 'MM')
ORDER BY TRUNC(DATE1, 'MM'))
SELECT n,
NVL(ROUND(SUM(Debit),2), 0)
FROM (select add_months(to_date('01/01/2006', 'dd/mm/yyyy'), level - 1) n FROM dual connect by level <= 12) months
LEFT JOIN S1
ON months.n = date1
GROUP BY n
ORDER BY n -
KE5Z : UserExit or SAP Note for adding new fields in the report output
Hi,
I want to add 2 new fields in KE5Z (Profit Center: Actual Line Items) report output.
Order reason(AUGRU), Sales Document Type (AUART) fields.
Is there any UserExit or SAP Note available for this....
Thanks in advance,
fractalHi Fractal,
See if Note 92864 will help you.
Summary
Symptom
Through a modification, it is possible for you to include additional fields in the profit center line-item reports 'actual' and 'plan' (Release 3.1*).
Additional key words
KE5Z, KE5Y, RCOPCA02, RCOPCA08 -
SUPPORTGUIDE 20010613143936 -
REPORTWRITER,
SGRW_OM SGRW_PS SGRW_PC SGRW_SL SGRW_PCA SGRW_EC SGRW_LIS
Cause and prerequisites
The fields must be located in table GLPCA (for actual) or GLPCP (for plan).
For Release 3.0F, you should ensure you have applied Note 62511 first.
Solution
To include a field in the actual line item report, proceed as follows:
Call the ABAP/4 Dictionary (Transaction SE11) and display table GLPCA. You can then find in a line the field name and data element for the field you want to include.
Return to the initial screen of the ABAP/4 Dictionary. Now change the structure RPCA2. If the structure does not yet contain the field, you select Edit -> Insert field; enter the field name and data element. Do not insert the new field at the beginning of the structure but in the rear half of the structure.
Then save and activate the structure.
Now call the ABAP Editor (Transaction SE38). Change the source code of program RCOPCA02. Insert the lines set out in the attachment in FORM routine FIELDCAT_FILL. When you do this, replace SGTXT by the field name of the field. If you normally want the field to be displayed when you the access the report, delete the line afield-no_out = 'X'. "<<<< insert Note 92864 .
You should note that the place where you insert the lines influences the position of the column in the report list.
To include a field in the Plan-line-item report, carry out the same procedure except with table GLPCP, structure RPCA8 and program RCOPCA08.
Note: Pls check if these 2 fields are available in any of the layout versions you have available with the transaction.
Cheers,
Vikram
Pls reward for helpful replies!! -
Adding new row to the reports list page
How can I add a new report row in the reports list of the reports tab.
Ex: a new row to the report "users by Date of Join report" is to be added
How can we add Please help me out in thisI am facing the same problem!
camickr wrote:
Try adding an empty row containing a null value for the String instead of the empty String.camickr, it will not help, the DefaultRowSorter in the "*+compare(int model1, int model2)+*" method return -1 if the first value is null and 1 if the sacond value is null. and incase of DESCENDING it mult by -1.
// Treat nulls as < then non-null
if (v1 == null) {
if (v2 == null) {
result = 0;
} else {
result = -1;
} else if (v2 == null) {
result = 1;
} else {
result = sortComparators[counter].compare(v1, v2);
if (sortOrder == SortOrder.DESCENDING) {
result *= -1;
}And this is the real problem!
The empty line is sorted as the smallest value and incase of DESCENDING it will be the first line (because of the mult by -1).
We could have overide it and incase of the empty row(usualy the last row) do not mult by -1 in DESCENDING mode.
But the problem is that the "+*compare*+" method and it's caller "*+Row+*" inner class are private :-(
It is not wise to do it but we can do like kmp83 wrote:
kmp83 wrote:
copy/duplicate "private" code from DefaultRowSorter into my extended class.Anyone have another suggestion? -
how can I add a new column to a report ?
this the code for the trigger
function BeforePForm return boolean is
begin
-- insert into test_java values(:p_order_by);
-- commit;
--return true;
IF Check_Access_For_Token(:p_Token, :p_Appmod_Code) THEN
return (TRUE);
ELSE
srw.message(1, 'You do not have access to the report!');
return (FALSE);
END IF;
end;
please help I need this for today -
Dynamic SQL Error -ORA-00904: invalid identifier
Hello!
I'm really hoping I can get some fast help on this. In the interest of honesty, this is for a university oracle programming assignment. I've searched everywhere I can for the answer and haven't had any luck.
Anyway, the problem in a nutshell. I have to write a package to write a text file. The formatting information for the file is held in a table, which has columns to define the various characteristics like justification, padding character and field value.
RECORDTYPE FIELDNAME FIELDVALUE FIELDSIZE FIELDORDER PADDINGCHAR JUSTIFICATION DATASOURCE
7 CreditTotal v_credit 10 5 '0' LPAD PROGRAM
7 RecordType '7' 1 1 ' ' RPAD HARDCODE
I can build the whole file except this footer. the FieldValue "v_credit" references a variable that has the calculated total of the credit amounts for the file. There are also "v_debit", and "(v_credit-v_debt)" entries.
My question seems simple... How can I use this VARCHAR2 value from the table, and have it reference the variable within a Dynamic SQL string? If I use the textvalue of the column in the SQL string it gives me the invalid identifier error when it hits the EXECUTE IMMEDIATE statement. There is another row for the header which has "to_char(sysdate,'DDMMYYYY')" in it, and that runs fine. I'm assuming because they are native SQL statements and variables.
I have tried encapsulating the v_credit in "s, and using dynamica bind variables but had the same problem passing the names to the USING clause.
The SQL string created by the procedure is: SELECT LPAD(v_credit,10,'0' ) FROM dual
The full error is:
ORA-00904: "V_CREDIT": invalid identifier
ORA-06512: at "BWOOD.PKG_BRIAN", line 108
ORA-06512: at line 2
Line 108 is the EXECUTE IMMEDIATE statement
I would really appreciate someones help! I'm happy to post the procedure I've written, with the caveat that it's sloppy student work and needs cleaning up of all the experimental commented attempts:)
Edited by: user5426606 on 20-May-2009 03:34 - Added a few more facts.Thank you for the fast replies. I'll post a short chunk of code to demonstrate.
The actual procedure is quite a bit longer, but this should give you the idea.
PROCEDURE build_dbfile (p_settlement_date IN DATE, p_settlement_key IN VARCHAR2, p_type IN VARCHAR2) AS
v_sqlString VARCHAR2(4000) := 'SELECT ';
v_rectype NUMBER := 7;
v_line LONG;
v_debit NUMBER := 0;
v_credit NUMBER := 0;
v_nrRecords NUMBER := 0;
CURSOR c_settlement IS... -- to select records for data rows
-- cursor to select the rows with the file formatting and data info
CURSOR c_header IS SELECT NVL(fieldvalue,fieldname) db_field, <---- selects the data column
fieldsize,
NVL(paddingchar, ''' ''') paddingchar,
NVL(justification,'LPAD') justification,
datasource
FROM FSS_DESKBANK_REF
WHERE recordtype = r_rec_types.recordtype
ORDER BY recordType, fieldorder;
-- SELECT to get the SUM of datarows for v_credit
SELECT SUM(transactionamount)
INTO v_credit...
-- SELECT to get the SUM of datarows for v_debit
SELECT SUM(transactionamount)
INTO v_debit....
FOR r_head IN c_header LOOP
v_sqlString := v_sqlString || r_head.justification|| '('
|| r_head.db_field ||','
|| r_head.fieldsize || ','
|| r_head.paddingchar || ')';
v_sqlString := v_sqlString || ' FROM ' || v_tbl_name;
DBMS_OUTPUT.PUT_LINE('SQL --> '||v_sqlString);
EXECUTE IMMEDIATE v_sqlString INTO v_line;
END LOOP;
DBMS_OUTPUT.PUT_LINE(v_line);
END build_dbfile;So the loop goes through the table rows, grabs each data value and formatting column, and builds the sql string, which is then passed to the execute statement. The issue is the ones where the datarow contains a reference to v_credit, and the error is generated. ie r_head.db_field contains the string "v_credit"
Satish, the sql does look like that in the string, but the string is built from the table, not hardcoded. ie v_sqlString = "SELECT LPAD(v_credit,10,'0' ) FROM dual" when it is passed to the EXECUTE IMMEDIATE.
Edited by: user5426606 on 20-May-2009 05:19 -
Multi-row sub query returns ORA-00904 :invalid identifier error
I am creating a report from two tables that I am not joining. I want a single line for every row in table1 that meets a date range. Table2 can contain none or many rows for each recored in table1. I want to get up to two fields from table2.
I was using a case statement to check if there was data and then an in-line query or subquery. Once again, the idea is to have a single line on the report for each table1 record.
I get this error with the code below. It seems the nested multi-row subquery can not see the a.cr_mas_cr_no identifier.
ORA-00904: "a"."cr_mas_cr_no": invalid identifier
Any help is greatly appreciated,
Sam
select
a.cr_mas_cr_no "CRNO", a.cr_mas_type "TYPE", a.cr_mas_status "CR Status",
a.cr_mas_date_logged "Logged date", a.CR_REL_REQ_APP_DATE "RTP approved",a.CR_REL_REQ_RTP_DATE "RTP Date",
a.cr_accepted_date "Complete", a.cr_mas_submitted_by "Requester",
select doc_user FROM crrm_cr_documents WHERE doc_cr_number =a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'BD' ) "Bus Design",
(select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TD' ) "Tech Design",
(select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TE' ) "User acceptance test",
case
when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 0
then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
end
"RTP #1",
case
when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 1
then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 2)
end
"RTP #2",
a.CR_REL_REQ_RTP_BY "Released by",
a.CR_ACCEPTED_BY "Post RTP User Acceptance",
a.cr_mas_title "Title", a.cr_mas_id "ID"
from
crrm_crmaster a
where
(a.CR_REL_REQ_RTP_DATE >= :P1109_BEGDATE and (a.CR_REL_REQ_RTP_DATE <= :P1109_ENDDATE) and
(a.cr_mas_status = 'Complete' or (a.cr_mas_status = 'Release Approved'and a.CR_REL_REQ_APP_DATE < :P1109_ENDDATE))
Message was edited by:
slavanawayIceman,
Thanks for the reply I will try your suggestion.
I will try and explain why I think two subqueries (an in-line query with a subquery?) are required. I will use the creation of the column RTP #1 as the example as the RTP #2 column is only different in the rownum selected.
Looking only at the lines that fail, here is my analysis. (If I rem out the two case lines the query runs, I just don't get two columns of data I need.) I will only examine the first case as the second is changed to extract the second approval via the rownum = 2 criteria. The first statement checks there is at least one RTP approval stored for the request and then gets the user who approved the request if the test is true.
case when
(select count(appr_user) from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') > 0
then
The above part works fine and the correct count of approvals is returned.
(select appr_user from (select * from crrm_cr_approvals where appr_cr_no=a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
end
"RTP #1",
I moved the parenthesis to the correct location. There can be multiple approvals for a given parent record. Some parent records need one, some need two approvals. If I replace
(select appr_user from (select * from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
with
(select appr_user from approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP' and rownum = 1)
The correct result is returned because it returns exactly one row as rownum=1 limits the query. When rownum = 2 then the query returns null as the rownum never gets to two as the rownum column is built via the set created by the second subquery.
The subquery builds a set of approvals for a specific "cr_no" and appr_type of "RTP". the outer query then looks at the rownum of the second query
Here is where I got the rownum information from;
http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
So here is what I think is happening;
1. Main query From and Where are processed. This should provide the "set" for the query
2.The from subqueries for RTP #1 and RTP #2 should be able to access the a.cr_mas_cr_no field and build a set from the approvals table.
3.The RTP #1/2 subquery (inline maybe a better description?) would then get the correct row from the from subquery.
The error "invalid identifier" refers to the a.cr_mas_cr_no field. I assume it means it can not resolve the table alias inside the subquery.
So maybe your grouping would help, I will try.
Sam -
OIM 11g R1 ORA-00904 invalid identifier
Hello,
When I try to create a "Create User" Request, I got this Error:
<Feb 7, 2013 4:50:28 PM COT> <Error> <oracle.iam.oimdataproviders.impl> <BEA-000000> <ORA-00904: "USR"."USR_UDF_ES_USUARIO_RPT_S_N": invalid identifier
java.sql.SQLSyntaxErrorException: ORA-00904: "USR"."USR_UDF_ES_USUARIO_RPT_S_N": invalid identifier
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
And I use any of the templates for create the request but OIM Log shows the same error.
And the request is not created successfully.
Please, help!
ThanksDid you create this field "USR_UDF_ES_USUARIO_RPT_S_N" ?
Go to USR table also verify this column. Does it exist ? -
I have a PL/SQL script processing information between Oracle database and MySQL database. My script ran perfectly with DG4ODBC 11.1.0.7. Then we upgraded Oracle to 10.2.0 and DG4ODBC 11.2.0.2. Now if I run my script from Solaris command line like ./myscript.shl, I get the following errors:
PL/SQL: ORA-00904: "cmswhit_moodle1"."mdl_grade_grades"."finalgrade": invalid identifier
PL/SQL: ORA-00904: "cmswhit_moodle1"."mdl_question_states"."attempt": invalid identifier
The strange thing is if I run the same query by cut and paste into sqlplus from command line, the query works perfectly without any problems.
What is the cause of this problem?
Any help would be greatly appreciated.
JeffreyHi Klaus,
The problem was solved after I updated MySQL ODBC to a new version from 5.1.8 to 5.1.13.
Summary of the problem and its solution:
The Problem: It appears that dg4odbc 11.2.0.2 requires a newer version of MyODBC. Previously I used MyODBC 5.1.8 which ran into problems with dg4odbc 11.20.0.2.
The Solution: After I updated MyODBC to 5.1.13, my PL/SQL scripts all work.
I need to point out that with MyODBC 5.1.8, I can run queries and updates from SQL*Plus console, but now PL/SQL scripts.
I'll close this thread.
Once again, thank you and happy holidays.
Jeffrey -
Error ORA-00904 invalid identifier
There are so many different employee rates colums in the employee table .
e.g)
emp_rate_1 column has all different salaries(10,20,30)
emp_rate_2 column has all different salaries(20,30,40)
If I do pick up one rate , it works fine as below
select
SUM(emp_rate_1) as emp_rate_1
from employee_t
result $60
but i have to summarize all different rate amount using loop. before looping method,
I tried as simple like below
declare
V_emp_rate_1_ID number;
begin
V_emp_rate_1_ID :=1;
select
SUM(emp_rate_||trim(V_emp_rate_1_ID)) as emp_rate_1
from employee_t ;
end;
I have an error message;
PL/SQL: ORA-00904: "emp_rate_": invalid identifier
ORA-06550: line 5, column 1:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
how can I put dynamic column into Sum() in the query?
or would you give me your advice to solve the solution.Not clear whether you are trying to get two sums (one for each column) or one sum that totals both columns)
select
SUM(emp_rate_1) as emp_rate_1
from employee_t
result $60But you can do all three with one query
select
SUM(emp_rate_1) as emp_rate_1, sum(emp_rate_2) as emp_rate_2, sum (emp_rate_1 + emp_rate_2) as sum_both
from employee_t -
Dynamic SQL Issue ORA-00904:invalid identifier error
Here is my SP
create or replace procedure srini_ref_cursor_test(p_county_code IN VARCHAR2,
p_ref_cur out PK_FR_TYPES.cursor_type) is
query_str varchar2(5000);
begin
query_str := 'SELECT * FROM dw_county where county_name = :P ';
open p_ref_cur for query_str USING p_county_code;
insert into srini_query_str_test values (query_str);
commit;
end srini_ref_cursor_test;
When I pass the p_county_code = Adams working find.
create or replace procedure srini_ref_cursor_test(p_county_code IN VARCHAR2,
p_ref_cur out PK_FR_TYPES.cursor_type) is
query_str varchar2(5000);
begin
query_str := 'SELECT * FROM dw_county where county_name in ('||p_county_code||')';
open p_ref_cur for query_str;
insert into srini_query_str_test values (query_str);
commit;
end srini_ref_cursor_test;
When I pass the p_county_code = Adams for above SP I got the following error
ORA-00904: "ADAMS": invalid identifier error
With out Bind variables how Can I pass the Char type values in Dynamic SQL ?
I would like to pass multipule values to p_county_code like 'Adams','Ashley' etc
How Can I do this ?
Thank for great help.
SriniHow do I write the Dynamic SQL for
SELECT * FROM DW_COUNTY WHERE COUNTY_NAME LIKE 'Ad%'
The usual way...
hr@ORA10G>
hr@ORA10G> var str varchar2(1000);
hr@ORA10G> var cr refcursor;
hr@ORA10G>
hr@ORA10G> exec :str := 'select * from employees where first_name like ''A%''';
PL/SQL procedure successfully completed.
hr@ORA10G> -- note the escape character for each single quote
hr@ORA10G> print str
STR
select * from employees where first_name like 'A%'
hr@ORA10G>
hr@ORA10G> exec open :cr for :str;
PL/SQL procedure successfully completed.
hr@ORA10G> print cr
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
103 Alexander Hunold AHUNOLD 590.423.4567 03-JAN-90 IT_PROG 9000 102 60
115 Alexander Khoo AKHOO 515.127.4562 18-MAY-95 PU_CLERK 3100 114 30
121 Adam Fripp AFRIPP 650.123.2234 10-APR-97 ST_MAN 8200 100 50
147 Alberto Errazuriz AERRAZUR 011.44.1344.429278 10-MAR-97 SA_MAN 12000 .3 100 80
158 Allan McEwen AMCEWEN 011.44.1345.829268 01-AUG-96 SA_REP 9000 .35 146 80
167 Amit Banda ABANDA 011.44.1346.729268 21-APR-00 SA_REP 6200 .1 147 80
175 Alyssa Hutton AHUTTON 011.44.1644.429266 19-MAR-97 SA_REP 8800 .25 149 80
185 Alexis Bull ABULL 650.509.2876 20-FEB-97 SH_CLERK 4100 121 50
187 Anthony Cabrio ACABRIO 650.509.4876 07-FEB-99 SH_CLERK 3000 121 50
196 Alana Walsh AWALSH 650.507.9811 24-APR-98 SH_CLERK 3100 124 50
10 rows selected.
hr@ORA10G>
hr@ORA10G>pratz
Maybe you are looking for
-
The crux of syncing with iTunes: Data minimization & changing settings
Hello everybody, I have a couple of questions regarding the syncing of "stuff" between my Mac and my iPhone. I used to own an iPod (3rd generation, quite a while ago), and I always had my own system of storing music. The thing is, I have my music on
-
Photoshop freezes when I click the Text tool.
Every time I try to use the text tool it freezes and I have to force quit. Any suggestions on how to get the bug out? I've uninstalled and reinstalled, that didn't seem to help.
-
Wi-Fi module in the MacBook Air'12
What's the Wi-Fi module in the MacBook Air'12 ? What is the maximum speed on the 2.4 GHz and 5 GHz ? And, how many antennas in it ? Where can I see that?
-
Report Parked documents by Accounting Clerk
Hi guys, Is it possible to search parked documents by Accounting Clerk (field within the vendor master) and then post them. Current workaround is to lookup parked documents by clerk in FBL1N (dynamic selection) and copy/paste these document numbers
-
Has something changed in Podcast App this last week?
I'm running iOS 6.1.3, Podcast's version is 1.2.1. I think within this past week I've lost the progress bar in my podcasts (time slider). Did I unconciously change a setting, or has a change happened to the App recently?