Column not allowed here
HI,
I have a function and i want t odo like this:
create or replace function func( dbl varchar2,tr varchar2)
return number
is
d2 timestamp :=sysdate;
trc varchar2(4):
dblnk varchar2(255);
begin
trc:=tr;
dbllnk:=dbl;
execute immediate 'insert into t@'||dblnk||' values (trc,d2)';----------in this statement
end;
i am getting above error:
Thanks
Hashmi wrote:
execute immediate 'insert into t@'||dblnk||' values (trc,d2)';----------in this statementYou should use bind variables there:
execute immediate 'insert into t@'||dblnk||' values (:b1,:b2)'
using trc, d2;
Similar Messages
-
PL/SQL: ORA-00984: column not allowed here
I am Trying to compile this procedure, but i get error, could please anybody help me out.
Thanks.
SQL> create or replace procedure FOF_sport_setup(
2 v_model_cd in varchar2, -- model_cd used in many place
3 v_portfolio_name in varchar2, -- portfolio name
4 v_src_acct_nbr in varchar2, -- source account number for port
5 v_src_fund_nbr in varchar2, -- source fund number
6 v_fmr_fund_nbr in varchar2, -- fidelity fund number
7 v_src_cd in varchar2, -- source code
8 v_last_mod_id in varchar2 -- your corp id
9 )
10 as
11 v_new_portf_id number(12);
12
13 begin
14
15 select max(portf_id) into v_new_portf_id from portfolios;
16
17 insert into portfolios
18 (portf_id,
19 portf_cd,
20 portf_name,
21 portf_typ_cd,
22 inception_date,
23 sub_product_cd,
24 product_cd,
25 product_line_cd,
26 bus_line_cd,
27 dly_perf_restr_ind,
28 portf_mgr_id,
29 seed_acct_nbr,
30 use_epas_ind,
31 epas_drop_perf_ind,
32 src_acct_nbr,
33 src_fund_nbr,
34 fmr_fund_nbr,
35 src_cd,
36 last_mod_id,
37 last_mod_dt)
38 values
39 (new_portf_id,
40 v_model_cd,
41 v_portfolio_name,
42 "RETAIL",
43 v_inception_date,
44 "FREE",
45 "FREE",
46 "FREE",
47 "PAS",
48 "Yes",
49 3,
50 "31635C101",
51 "N",
52 "Y",
53 v_src_acct_nbr,
54 v_src_fund_nbr,
55 v_fmr_fund_nbr,
56 v_src_cd,
57 v_last_mod_id,
58 sysdate);
59
60 end;
61 /
Warning: Procedure created with compilation errors.
SQL> show errors procedure FOF_sport_setup
Errors for PROCEDURE FOF_SPORT_SETUP:
LINE/COL ERROR
17/2 PL/SQL: SQL Statement ignored
51/3 PL/SQL: ORA-00984: column not allowed here
SQL>create or replace procedure FOF_sport_setup(
v_model_cd in varchar2, -- model_cd used in many places for portf_id,
v_portfolio_name in varchar2, -- portfolio name
v_inception_date in varchar2,
v_src_acct_nbr in varchar2, -- source account number for portfolio table in sport db
v_src_fund_nbr in varchar2, -- source fund number
v_fmr_fund_nbr in varchar2, -- fidelity fund number
v_src_cd in varchar2, -- source code
v_last_mod_id in varchar2 -- your corp id
as
v_new_portf_id number(12);
begin
select max(portf_id) into v_new_portf_id from portfolios;
insert into portfolios
(portf_id,
portf_cd,
portf_name,
portf_typ_cd,
inception_date,
sub_product_cd,
product_cd,
product_line_cd,
bus_line_cd,
dly_perf_restr_ind,
portf_mgr_id,
seed_acct_nbr,
use_epas_ind,
epas_drop_perf_ind,
src_acct_nbr,
src_fund_nbr,
fmr_fund_nbr,
src_cd,
last_mod_id,
last_mod_dt)
values
(v_new_portf_id,
v_model_cd,
v_portfolio_name,
'RETAIL',
to_date('v_inception_date'),
'FREE',
'FREE',
'FREE',
'PAS',
'Yes',
3,
'31635C101',
'N',
'Y',
v_src_acct_nbr,
v_src_fund_nbr,
v_fmr_fund_nbr,
v_src_cd,
v_last_mod_id,
sysdate);
end;
=====================
The procedure got created without any errors, when i am trying to execute the procedure i am getting errors.
this is the parameters which i am passing:
exec FOF_sport_setup('01213', 'PAS International Fund of Funds', '2/15/2006', '01213', 'IFOFB', 'IFOFB', 'FPCMS', 'a382077')
SQL> exec FOF_sport_setup('01213', 'PAS International Fund of Funds', '2/15/2006', '01213', 'IFOFB',
'IFOFB', 'FPCMS', 'a382077')
BEGIN FOF_sport_setup('01213', 'PAS International Fund of Funds', '2/15/2006', '01213', 'IFOFB', 'IF
ERROR at line 1:
ORA-01858: a non-numeric character was found where a numeric was expected
ORA-06512: at "SPORT.FOF_SPORT_SETUP", line 15
ORA-06512: at line 1
===============
the description for the table is below
===========
SQL> desc portfolios
Name Null? Type
PORTF_ID NOT NULL NUMBER(25)
PORTF_CD VARCHAR2(10)
PORTF_NAME VARCHAR2(60)
STRATEGY_CD VARCHAR2(10)
CO_STOCK_LEV_CD VARCHAR2(10)
EFF_DATE DATE
PORTF_WEB_NAME VARCHAR2(60)
PORTF_TYP_CD VARCHAR2(10)
INCEPTION_DATE DATE
CLOSE_DATE DATE
SUB_PRODUCT_CD VARCHAR2(10)
PRODUCT_CD VARCHAR2(10)
PRODUCT_LINE_CD VARCHAR2(10)
BUS_LINE_CD VARCHAR2(10)
BUS_GRP_CD VARCHAR2(10)
PLAN_CD VARCHAR2(10)
ADVISOR_CD VARCHAR2(10)
RISK_LEVEL_CD VARCHAR2(10)
DLY_PERF_RESTR_IND VARCHAR2(3)
SUB_PORTF_IND CHAR(1)
PORTF_MGR_ID NUMBER(25)
SEED_ACCT_NBR VARCHAR2(9)
OBJECTIVE VARCHAR2(255)
PORTF_COMPOSITION_DESC VARCHAR2(50)
LGL_GRP VARCHAR2(30)
USE_EPAS_IND VARCHAR2(3)
EPAS_MODEL_NAME VARCHAR2(50)
EPAS_DROP_PERF_IND VARCHAR2(3)
SRC_ACCT_NBR VARCHAR2(15)
SRC_FUND_NBR VARCHAR2(6)
FMR_FUND_NBR VARCHAR2(6)
NET_ASSETS NUMBER(25,8)
SEED_MKT_VAL NUMBER(25,10)
ACCT_MKT_VAL NUMBER(25,10)
TOTAL_ASSETS NUMBER(25,10)
NET_OTHER_ASSETS NUMBER(25,8)
ACCRUED_INCOME NUMBER(25,10)
ACCRUED_INTEREST NUMBER
LIABILITIES NUMBER(25,10)
SHARES_OUTSTANDING NUMBER(25,10)
PRINCIPAL_CASH NUMBER(25,10)
INCOME_CASH NUMBER(25,10)
INVESTIBLE_CASH NUMBER(25,10)
SHIP_DATE DATE
REBALANCE_IND CHAR(1)
OUTBOUND_IND VARCHAR2(5)
LGL_MSG_CD CHAR(1)
LAST_SETTLE_DATE DATE
LAST_TRD_DATE DATE
LAST_ALLOC_DATE DATE
STATUS_CD CHAR(1)
SRC_CD NOT NULL VARCHAR2(5)
LAST_MOD_ID NOT NULL VARCHAR2(10)
LAST_MOD_DT NOT NULL DATE
PORTF_MGD_CD VARCHAR2(10)
========== -
ORA-01733- virtual column not allowed here - Insert using inline view
Does anyone know why I am getting ORA-01733- virtual column not allowed here
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
---no error without WITH CHECK option
SQL> INSERT INTO
2 (SELECT
3 location_id,
4 city,
5 l.country_id
6 FROM countries c, locations l,regions r
7 where l.country_id = c.country_id
8 and r.region_id=c.region_id
9 and r.region_name = 'Asia')
10 VALUES (5500, 'Wansdworth Common', 'UK');
1 row created.
SQL> rollback;
Rollback complete.
-----error with WITH CHECK OPTION
SQL> INSERT INTO
2 (SELECT
3 location_id,
4 city,
5 l.country_id
6 FROM countries c, locations l,regions r
7 where l.country_id = c.country_id
8 and r.region_id=c.region_id
9 and r.region_name = 'Asia' WITH CHECK OPTION)
10 VALUES (5500, 'Wansdworth Common', 'UK');
INSERT INTO
ERROR at line 1:
ORA-01733: virtual column not allowed here
I was expecting
ORA-01402: view WITH CHECK OPTION where-clause violation
for the second one. Is there anything I am missing here ?Randolf
Thank you very much for the update to this old question
After reading the link I think I should ignore this error and accept it as ORA-01402
The information you asked me to check did not lead me an understanding of different error types.
SQL> ----view for ORA-01733
SQL> create view test_v_1
2 as
3 SELECT
4 location_id,
5 city,
6 l.country_id
7 FROM countries c, locations l,regions r
8 where l.country_id = c.country_id
9 and r.region_id=c.region_id
10 and r.region_name = 'Asia' WITH CHECK OPTION;
View created.
SQL>
SQL>
SQL>
SQL> select * from user_updatable_columns where table_name='TEST_V_1';
OWNER TABLE_NAME COLUMN_NAME UPD INS DEL
HR TEST_V_1 CITY YES YES YES
HR TEST_V_1 COUNTRY_ID NO NO NO
HR TEST_V_1 LOCATION_ID YES YES YES
SQL>
SQL> ----view for ORA-01402
SQL>
SQL> create view test_v_2
2 as
3 SELECT
4 d.department_id,
5 d.department_name,
6 d.location_id
7 FROM hr.departments d,hr.locations l
8 WHERE l.location_id=d.location_id
9 and d.location_id < 2000
10 WITH CHECK OPTION;
View created.
SQL>
SQL> select * from user_updatable_columns where table_name='TEST_V_2';
OWNER TABLE_NAME COLUMN_NAME UPD INS DEL
HR TEST_V_2 DEPARTMENT_ID YES YES YES
HR TEST_V_2 DEPARTMENT_NAME YES YES YES
HR TEST_V_2 LOCATION_ID NO NO NO
SQL>
SQL>
SQL> ----INSERT STILL FAILING WITH DIFFERENT ERROR DESPITE THE SAME UPDATABLE COLUMN STRUCTURE
SQL> insert into test_v_1 values (5500, 'Wansdworth Common', 'UK');
insert into test_v_1 values (5500, 'Wansdworth Common', 'UK')
ERROR at line 1:
ORA-01733: virtual column not allowed here
SQL> insert into test_v_2 values (9999, 'Entertainment', 2500);
insert into test_v_2 values (9999, 'Entertainment', 2500)
ERROR at line 1:
ORA-01402: view WITH CHECK OPTION where-clause violation
SQL>A. Coskan GUNDOGAR
Oracle DBA
http://coskan.wordpress.com
“A man's errors are his portals of discovery.”
James Joyce -
Virtual Column not allowed here Error
Hi All,
I am facing "Virtual Column not allowed here" Error when running a simple select statement. I have identified that if I am removing a primary key constraint and an index on top of month table which is used in the SQL solving this issue. But want to know the exact reason of this error. FYI I am having two indexes on Month_end_date_key (which is also a primary key) and Month_end_date. Could you please let me know the reason for this.
FYI I am not doing any insert,update deletion operations. I am using only the tables in the SQL not using any views.
Regards,
Radhakrishna924486 wrote:
Hi All,
I am facing "Virtual Column not allowed here" Error when running a simple select statement. I have identified that if I am removing a primary key constraint and an index on top of month table which is used in the SQL solving this issue. But want to know the exact reason of this error. FYI I am having two indexes on Month_end_date_key (which is also a primary key) and Month_end_date. Could you please let me know the reason for this.
FYI I am not doing any insert,update deletion operations. I am using only the tables in the SQL not using any views.
Regards,
RadhakrishnaAre you sure none of those is a view?
Cause: An attempt was made to use an INSERT, UPDATE, or DELETE statement on an expression in a view.
Action: INSERT, UPDATE, or DELETE data in the base tables, instead of the view. -
Execute immediate column not allowed here error
Hi,
I have the following procedure
CREATE OR REPLACE PROCEDURE SWF_ICD
IS
SEQSWF NUMBER;
req VARCHAR2(1000):='';
BEGIN
DBMS_OUTPUT.ENABLE( 1000000 ) ;
DBMS_OUTPUT.PUT_LINE('DEBUT');
FOR CUR1 IN (SELECT * FROM ICD WHERE ETAICD=5)
LOOP
SELECT SEQ_SWF.NEXTVAL INTO SEQSWF FROM DUAL;
FOR CUR2 IN (SELECT CODCSWSSW,CODSSW,RUBSSW FROM SSW,OSW
WHERE INSOSW='ICD' AND CODCSWSSW=CODCSWOSW)
LOOP
req:= 'INSERT INTO SWF (SEQESWSWF,CODCSWSWF,CODSSWSWF,VALSWF) '
|| 'VALUES (CUR2.SEQSWF,CUR2.CODCSWSSW,CUR2.CODSSW,CUR1.' || CUR2.RUBSSW || ')';
DBMS_OUTPUT.PUT_LINE('req : ' || req);
EXECUTE IMMEDIATE req;
END LOOP;
END LOOP;
DBMS_OUTPUT.PUT_LINE('FIN');
END;
The procedure is created but when running i have the following error column not allowed here.
pls advise.Hi
Try EXECUTE IMMEDIATE sql USING ... syntax.
EXECUTE IMMEDIATE dynamic_string
[INTO {define_variable[, define_variable]... | record}]
[USING [IN | OUT | IN OUT] bind_argument
[, [IN | OUT | IN OUT] bind_argument]...]
[{RETURNING | RETURN} INTO bind_argument[, bind_argument]...];
Please see the link for more info.
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/11_dynam.htm#13131
Thanks -
Getting the error column not allowed here in jdbc
i have got an error
when using jdbc.
i have inserted the data from taking java textfields.
The error is:column not allowed here.
how to rectify this?
iam eagerly waiting for ur reply.Hi,
This is the forum for the SQL Developer Data Modeler product.
I suggest you try asking your question on the SQL and PL/SQL Forum: PL/SQL
David -
ORA-00984 Column not allowed here. Please help.
Hey, I have made a table;
CREATE TABLE Borrower (
BorId VARCHAR2(5) NOT NULL,
BorName VARCHAR2(20),
BorMaxBooks NUMBER(10),
PRIMARY KEY (BorId));
I am trying to enter values into this table;
INSERT INTO Borrower VALUES (
001, "Jack Jones", 5);
And I get an error; ORA-00984 Column not allowed here. Please can anyone help?? I have tried changing BorName VARCHAR2(20) to BorName CHAR(20) and everything I can think of.Hi sorry to bother you again but is it the same method as in MySQL to enter multiple data at once?
I am trying to save time by entering all the contents of a table all at once,
Would it be;
INSERT INTO Borrower (BorId, BorName, BorMaxBooks) VALUES (
(001, 'Bob', 4),
(002, 'James', 5),
(003, 'Dave', 6);
Thanks. -
Help - error : ORA-00984: Column not allowed here
Hi,
I'm writing a simple Java program to update values into Oracle tables. But getting error - 'ORA-00984: Column not allowed here' in the line - sql2.executeUpdate(acctTabSql);
There is no column name used in 'insert statement - and referred suggestion here to resolve the error, but couldn't. Please write me how to resolve it. ?
Here is the code snippet below.
Thanks, Vasu
T_ACCT
ACCT_ID (PK) GEN INTEGER
ALS_NBR:STRING
STATUS_CD:STRING
NOTE_DT:DATE
int intVal1 = 0;
int intVal2 = 0;
Statement sql1 = oraConnection.createStatement();
ResultSet rs = sql1.executeQuery("SELECT ACCT_ID_SEQ.NEXTVAL, APPL_ID_SEQ.NEXTVAL FROM DUAL");
while(rs.next()){
intVal1 = rs.getInt(1);
intVal2 = rs.getInt(2);
System.out.println("ACCT_ID :" + intVal1);
System.out.println("APPL_ID :" + intVal2);
sql1.close();
Statement sql2 = oraConnection.createStatement();
String acctTabSql = "INSERT INTO VPDBO.T_ACCT (ACCT_ID, ALS_NBR, NOTE_DT, HELMS_NBR, SL_REF_NBR, BK_MSG_RECEIVED_DT) " +
"VALUES (intVal1,'' ,'' ,'' ,'' ,'' )";
System.out.println(acctTabSql);
-/Error/- sql2.executeUpdate(acctTabSql);
sql2.close();
Statement sql3 = oraConnection.createStatement();
String applTabSql = "INSERT INTO T_APPL (APPL_ID, ACAPS_ID, STATUS_CD, ACAPS_PROD_CD, ACCT_ID, DCAPP_MSG_RECEIVED_DT) " +
"VALUES (intVal1, valappIdValue, 'EN', '', intVal2, '08/26/09')";
System.out.println(applTabSql);
sql3.executeUpdate(applTabSql);
sql3.close();
oraConnection.commit();Hi,
make sure final statement is like :
INSERT INTO VPDBO.T_ACCT (ACCT_ID, ALS_NBR, NOTE_DT, HELMS_NBR, SL_REF_NBR, BK_MSG_RECEIVED_DT)
VALUES(intVal1,NULL,NULL,NULL,NULL,NULL)instead of
String acctTabSql = "INSERT INTO VPDBO.T_ACCT (ACCT_ID, ALS_NBR, NOTE_DT, HELMS_NBR, SL_REF_NBR, BK_MSG_RECEIVED_DT) " +
"VALUES (intVal1,'' ,'' ,'' ,'' ,'' )";Cheers,
Avin ash -
Database trigger - PL/SQL: ORA-00984: column not allowed here
I am trying to create a trigger that will update an employee audit table when a row is changed. Using a sequence number to assign a unique identifier to each row as it is created. Need to capture the user ID, date of the change, and the action (update), plus the before image of the row.
CREATE SEQUENCE emp_audit_seq START WITH 10;
Create table emp (
empno NUMBER(4) Primary Key,
ename VARCHAR2(10),
job VARCHAR2(9),
mgr NUMBER(4),
hiredate DATE,
sal NUMBER(7,2),
comm NUMBER(7,2),
deptno NUMBER(2));
CREATE TABLE emp_audit (
audit_uid NUMBER(15) Primary Key,
change_date DATE,
change_user VARCHAR2(30),
action CHAR(1),
empno NUMBER(4),
ename VARCHAR2(10),
job VARCHAR2(9),
mgr NUMBER(4),
hiredate DATE,
sal NUMBER(7,2),
comm NUMBER(7,2),
deptno NUMBER(2));
CREATE OR REPLACE TRIGGER trig_emp_audit
BEFORE UPDATE ON emp
FOR EACH ROW
BEGIN
INSERT INTO emp_audit
VALUES(emp_audit_seq.nextval, change_date, change_user, action, :old.empno, :old.ename, :old.job, :old.mgr, :old.hiredate, :old.sal, :old.comm, deptno);
END;
Warning: Trigger created with compilation errors.
SQL> show errors
Errors for TRIGGER TRIG_EMP_AUDIT:
LINE/COL ERROR
2/3 PL/SQL: SQL Statement ignored
3/149 PL/SQL: ORA-00984: column not allowed hereCan anyone assist in helping me find what I am doing wrong with the trigger?
Edited by: LostNoob on Aug 25, 2012 2:24 PMFirst, when you write an INSERT statement, it's always good to list the columns that you're inserting into. That makes the code easier to follow-- you don't have to separately pull up the table definition to know what order columns are inserted. And it makes the code more maintainable since the statement won't become invalid if you add a new column to the table in the future.
Second, CHANGE_DATE, CHANGE_USER, and ACTION are not (presumably) functions and they are not local variables so it doesn't make sense to use them in an INSERT statement. You would need to write code or leverage existing functions to populate those columns. I'm guessing, for example, that you want to use SYSDATE to populate the CHANGE_DATE and USER to populate the CHANGE_USER column. My guess is that ACTION should always be a 'U' for UPDATE.
Third, it appears that you left off the :old on the DEPTNO column.
Putting it all together, you'd have something like
CREATE OR REPLACE TRIGGER trig_emp_audit
BEFORE UPDATE ON emp
FOR EACH ROW
BEGIN
INSERT INTO emp_audit(
audit_uid,
change_date,
change_user,
action,
enpno,
ename,
job,
mgr,
hiredate,
sal,
comm,
deptno )
VALUES(
emp_audit_seq.nextval,
sysdate,
user,
'U',
:old.empno,
:old.ename,
:old.job,
:old.mgr,
:old.hiredate,
:old.sal,
:old.comm,
:old.deptno);
END;
/ Justin -
Column Not Allowed Here? Why?
CREATE TABLE course_location(
venue_id number(6),
street_address varchar2(30),
postal_code varchar2(8),
county varchar2(16),
PRIMARY KEY (venue_id)
INSERT INTO course_location (venue_id, street_address, postal_code, county)
VALUES (162, '9 Illing Way', 'PO13 3HA', Hampshire);
INSERT INTO course_location (venue_id, street_address, postal_code, county)
VALUES (287, '18 Hating Place', 'SO13 4DA', Hampshire);
INSERT INTO course_location (venue_id, street_address, postal_code, county)
VALUES (91, '24 Lauren Way', 'SO17 6TA', Hampshire);
INSERT INTO course_location (venue_id, street_address, postal_code, county)
VALUES (61, '9 Wotton Way', 'SL6 3ED', Berkshire);
INSERT INTO course_location (venue_id, street_address, postal_code, county)
VALUES (19, '10 Soul Lane', 'GU21 7TA', Berkshire);'Hampshire' - this is a string literal
Hampshire - this is an identifier, probably a column name (of course there is no column called HAMPSHIRE in your table, but even if there was one it cannot be referenced here).
Do you see the difference?
You are missing ' '.
Yes, I agree - the error message could be more human-friendly :) -
ORA-00984: Column not allowed here.
Hi there, I've got a little problem with the ORA-00984 error. I just begun PL/SQL, so maybe you can support me with this.
I want to write a Trigger that fires every time a row in a table is changed or deleted. Trigger should write the following into a seperate table:
[mumblejumble ...]
THEN
INSERT INTO "PROJECT"."T_HISTORY" (subtopic_id, change_date, old_schedule_date, old_description, changes_id) VALUES (
var_subtopic_id,
TO_DATE(sysdate,'DD.MM.YY'),
var_old_schedule_date,
var_old_decription,
'1');
troublemaker is this line:
TO_DATE(sysdate,'DD.MM.YY'),
Gives ORA-00984. I tried a single sysdate as well, same problem.
Somebody got a clue or workaround? I can't figure out how to insert the sysdate another way.
Regards,
ThomasHere you go, this is the current version:
CREATE OR REPLACE
TRIGGER TRIGGER_TEST_HISTORY BEFORE UPDATE OR DELETE ON T_SUBTOPICS
DECLARE
var_subtopic_id NUMBER(6);
var_old_schedule_date DATE;
var_old_description VARCHAR2(1000);
BEGIN
/* Trigger soll Datensätze nach t_history kopieren, zusammen mit einer Beschreibung der Änderung!
/* Datensätze aus Tabelle holen */
SELECT subtopic_id, schedule_date, description INTO var_subtopic_id, var_old_schedule_date, var_old_description FROM t_subtopics;
/* Abfragen, wie geändert wurde */
IF UPDATING
THEN
INSERT INTO "PROJECT"."T_HISTORY" (subtopic_id, change_date, old_schedule_date, old_description, changes_id) VALUES (
var_subtopic_id,
sysdate,
var_old_schedule_date,
var_old_decription,
'1');
/* Oder gelöscht? */
ELSIF DELETING
THEN
INSERT INTO "PROJECT"."T_HISTORY" (subtopic_id, change_date, old_schedule_date, old_description, changes_id) VALUES (
var_subtopic_id,
sysdate,
var_old_schedule_date,
var_old_decription,
'2');
END IF;
END;
Pretty primitive, but that was the first way that came into my mind.
Edited spelling mistake
Message was edited by:
Thomas Anders -
PL/SQL: ORA-00984: column not allowed here (emp.no)
I want to insert the value of a portlet form field into a table.
Any help ?
procedure afterValidation
p_block_name in varchar2,
p_object_name in varchar2,
p_instance in integer,
p_event_type in varchar2,
p_user_args in varchar2,
p_session in out nocopy PORTAL.wwa_api_module_session
is
begin
INSERT INTO PARAMS(F_SESSION,FN_1) VALUES(USERENV('SESSIONID'),EMP.NO );
end;I want to insert the value of a portlet form field into a table.
Any help ?
procedure afterValidation
p_block_name in varchar2,
p_object_name in varchar2,
p_instance in integer,
p_event_type in varchar2,
p_user_args in varchar2,
p_session in out nocopy PORTAL.wwa_api_module_session
is
begin
INSERT INTO PARAMS(F_SESSION,FN_1) VALUES(USERENV('SESSIONID'),EMP.NO );
end; -
When Closing the window giving error " Virtual Column not allowed"
Hi All,
In my main block, i have a button, on clicking which will open a new window(block) with a free text field to enter.
I have a Save button in a new window which will save entered text fiedl and refresh the main block to see the value entered in a new block.
But suppose, if entered something in text field and without saving if i close the window and try to exit from the form
It is asking me to save the form or not and if i press Yes
Then it gives me below error
ORA-01733: virtual column not allowed here
FRM-40508: ORACLE error: unable to INSERT record.
If i see from Display database error' It is trying to insert the record into the view On which my new block has based( i know it is not possible).
Any suggestion on this please?
Thanks,
pavanPavan,
How are you populating your block? It sounds like you are populating the block manually (eg; Looping through a cursor and assigning values to each row of your block). If this is what you are doing, then YES you will get these kinds of errors. Ideally, you should base your data block on your data (either directly on the base table or view of if you are using a query, then a FROM Clause based block).
I'm guessing here, so would you mind posting a description of your data block(s) is/are set up?
Craig... -
Sequence Number does not allowed here
Hi,
I am inserting rows in a table called membership with seqence number membership_id.nextval. But i am getting error like
"Sequence number not allowed here"
Before i inserted about 3852 rows in that table
Here is the statement i am using
INSERT INTO MEMBERSHIP (membership_id,ACTIVIST_ID,G_N_ID,ROLE_ID,
REGION_ID,START_dATE,END_DATE,STATUS,state_id)
SELECT membership_id.nextval,a.activist_id,G.g_n_id,R.ROLE_ID,
'',mwlgmemship.start_date,'','Active',''
FROM activist a,
role r,
group_network g,
final.mwlgmemship mwlgmemship,final.mwlgmem mwlgmem
WHERE
a.first_name=mwlgmem.fname and a.last_name=mwlgmem.lname and a.c_zip_code=mwlgmem.czip and
a.c_country=mwlgmem.country and mwlgmem.person_id=mwlgmemship.person_id and
to_char(mwlgmemship.grno)=g.g_n_reference and mwlgmemship.role_id=r.role_id order by r.role_id
I could not understand the problem, please help me
I am selecting the other fields from other tables.
Thanks
SrinivasRestrictions on Sequence Values You cannot use CURRVAL and NEXTVAL in the following constructs:
A subquery in a DELETE, SELECT, or UPDATE statement
A query of a view or of a materialized view
A SELECT statement with the DISTINCT operator
A SELECT statement with a GROUP BY clause or ORDER BY clause
A SELECT statement that is combined with another SELECT statement with the UNION, INTERSECT, or MINUS set operator
The WHERE clause of a SELECT statement
The DEFAULT value of a column in a CREATE TABLE or ALTER TABLE statement
The condition of a CHECK constraintAbove text is from the sql reference manual.
HTH
Regards
Raj -
ORA-04044: procedure, function, package, or type is not allowed here
Hi,
I am trying to build an object hierarchy.The object hirarcy is for a multi division, multi department, multi cost center and multi operation Organisation.Multiple department can store into multiple divisions, multiple cost center can store into multiple departments, multiple operations can store into multiple cost centers.
The structure I try to built like this:
create type div_obj_new as object
(id number,
divdesc varchar2(100)
create type div_obj_tab as
table of div_obj_new
create type dept_obj_new as object
(id number,
deptdesc varchar2(100),
dept_div number
create type dept_obj_tab as
table of dept_obj_new
create type cctr_obj_new as object
(id number,
cctrdesc varchar2(100),
cctr_dept number
create type cctr_obj_tab as
table of cctr_obj_new
create type oper_obj_new as object
(id number,
operdesc varchar2(100),
oper_cctr number
create type oper_obj_tab as
table of oper_obj_new
==========================
create type div_obj_type as object
(divid div_obj_tab)
NOT FINAL
create type dept_obj_type under div_obj_type
(deptid dept_obj_tab)
NOT FINAL
create type cctr_obj_type under dept_obj_type
(cctrid cctr_obj_tab)
NOT FINAL
create type oper_obj_type under cctr_obj_type
(operid oper_obj_tab)
NOT FINAL
=======This Table creation is not working=================
create table organisation
(div div_obj_type,
dept dept_obj_type,
cctr cctr_obj_type,
oper oper_obj_type)
nested table div store as division_table
nested table dept store as department_table
nested table cctr store as costcntr_table
nested table oper store as operation_table
nested table oper store as operation_table
ERROR at line 9:
ORA-22912: specified column or attribute is not a nested table type
=========================================================
Then I try to insert record into the div_obj_type instead of organisation table as it was not working.
The insert script is as follows:
===================================
insert into div_obj_type values
div_obj_tab
(div_obj_new(01,'Division 01'),
div_obj_new(02,'Division 02'),
div_obj_new(03,'Division 03'),
div_obj_new(04,'Division 04')
dept_obj_tab
dept_obj_new(10,'Department 10',1),
dept_obj_new(11,'Department 11',1),
dept_obj_new(12,'Department 12',2),
dept_obj_new(13,'Department 13',3),
dept_obj_new(14,'Department 14',4),
dept_obj_new(15,'Department 15',5),
dept_obj_new(16,'Department 16',6),
dept_obj_new(17,'Department 17',7)
cctr_obj_tab
cctr_obj_new(100,'Cost Center 100',10),
cctr_obj_new(101,'Cost Center 101',11),
cctr_obj_new(100,'Cost Center 102',12),
cctr_obj_new(100,'Cost Center 103',13),
cctr_obj_new(100,'Cost Center 104',14),
cctr_obj_new(100,'Cost Center 105',15),
cctr_obj_new(100,'Cost Center 106',16),
cctr_obj_new(100,'Cost Center 107',17),
cctr_obj_new(100,'Cost Center 108',10),
cctr_obj_new(100,'Cost Center 109',11),
cctr_obj_new(100,'Cost Center 110',12)
oper_obj_tab
oper_obj_new(1000,'Operation 1000',100),
oper_obj_new(1000,'Operation 1001',101),
oper_obj_new(1000,'Operation 1002',102),
oper_obj_new(1000,'Operation 1003',103),
oper_obj_new(1000,'Operation 1004',104),
oper_obj_new(1000,'Operation 1005',105),
oper_obj_new(1000,'Operation 1006',106),
oper_obj_new(1000,'Operation 1007',107),
oper_obj_new(1000,'Operation 1008',108),
oper_obj_new(1000,'Operation 1009',109),
oper_obj_new(1000,'Operation 1010',110),
oper_obj_new(1000,'Operation 1011',101),
oper_obj_new(1000,'Operation 1012',102),
oper_obj_new(1000,'Operation 1013',103),
oper_obj_new(1000,'Operation 1014',104),
oper_obj_new(1000,'Operation 1015',105),
oper_obj_new(1000,'Operation 1016',106),
oper_obj_new(1000,'Operation 1017',107),
oper_obj_new(1000,'Operation 1018',108)
insert into div_obj_type values
ERROR at line 1:
ORA-04044: procedure, function, package, or type is not allowed here
Actually I want to create an object view or object table with all the details of division, department , cost center and operation and it will store depending upon the respective upper level hirarcy 's id.For eg. department details can be fetched through division id etc..
So I can't figure out what to do for this kind of structure and how to do that.
I am running Oracle Release 2 (9.2.0.1.0) for Windows 2000.
Any help , advice or suggestions will be appreciated.
Thanks & Regards
NiharHi Cameron,
Thanks for your great suggestion.Actually what you have suggested is correct and it was tested by me correctly.But actually I want to store records in the multiple objects hirarcy depending upon the respective upper level hirarcy 's id.For say how can I retrive all records related to divisionID which is in the top level hirarchy? So by selecting divisionID=01, how can I easily select all depts,cost centers and Operation details?
Again I have another problem , when try to retrive record using PL/SQL I got some problem.
Structure as created above.Again I am giving here.
create type div_obj_new as object
(id number,
divdesc varchar2(100)
create type div_obj_tab as
table of div_obj_new
create type dept_obj_new as object
(id number,
deptdesc varchar2(100),
dept_div number
create type dept_obj_tab as
table of dept_obj_new
create type cctr_obj_new as object
(id number,
cctrdesc varchar2(100),
cctr_dept number
create type cctr_obj_tab as
table of cctr_obj_new
create type oper_obj_new as object
(id number,
operdesc varchar2(100),
oper_cctr number
create type oper_obj_tab as
table of oper_obj_new
create table organisation
(div div_obj_tab,
dept dept_obj_tab,
cctr cctr_obj_tab,
oper oper_obj_tab)
nested table div store as division_table
nested table dept store as department_table
nested table cctr store as costcntr_table
nested table oper store as operation_table
insert into organisation values
div_obj_tab
(div_obj_new(01,'Division 01'),
div_obj_new(02,'Division 02'),
div_obj_new(03,'Division 03'),
div_obj_new(04,'Division 04')
dept_obj_tab
dept_obj_new(10,'Department 10',1),
dept_obj_new(11,'Department 11',1),
dept_obj_new(12,'Department 12',2),
dept_obj_new(13,'Department 13',3),
dept_obj_new(14,'Department 14',4),
dept_obj_new(15,'Department 15',5),
dept_obj_new(16,'Department 16',6),
dept_obj_new(17,'Department 17',7)
cctr_obj_tab
cctr_obj_new(100,'Cost Center 100',10),
cctr_obj_new(101,'Cost Center 101',11),
cctr_obj_new(100,'Cost Center 102',12),
cctr_obj_new(100,'Cost Center 103',13),
cctr_obj_new(100,'Cost Center 104',14),
cctr_obj_new(100,'Cost Center 105',15),
cctr_obj_new(100,'Cost Center 106',16),
cctr_obj_new(100,'Cost Center 107',17),
cctr_obj_new(100,'Cost Center 108',10),
cctr_obj_new(100,'Cost Center 109',11),
cctr_obj_new(100,'Cost Center 110',12)
oper_obj_tab
oper_obj_new(1000,'Operation 1000',100),
oper_obj_new(1000,'Operation 1001',101),
oper_obj_new(1000,'Operation 1002',102),
oper_obj_new(1000,'Operation 1003',103),
oper_obj_new(1000,'Operation 1004',104),
oper_obj_new(1000,'Operation 1005',105),
oper_obj_new(1000,'Operation 1006',106),
oper_obj_new(1000,'Operation 1007',107),
oper_obj_new(1000,'Operation 1008',108),
oper_obj_new(1000,'Operation 1009',109),
oper_obj_new(1000,'Operation 1010',110),
oper_obj_new(1000,'Operation 1011',101),
oper_obj_new(1000,'Operation 1012',102),
oper_obj_new(1000,'Operation 1013',103),
oper_obj_new(1000,'Operation 1014',104),
oper_obj_new(1000,'Operation 1015',105),
oper_obj_new(1000,'Operation 1016',106),
oper_obj_new(1000,'Operation 1017',107),
oper_obj_new(1000,'Operation 1018',108)
===============
declare
div number;
divdesc varchar2(100);
divdetails varchar2(100);
dept number;
deptdesc varchar2(100);
deptdetails varchar2(100);
cctr number;
cctrdesc varchar2(100);
cctrdetails varchar2(100);
oper number;
operdesc varchar2(100);
operdetails varchar2(100);
cursor c_div is
select d.id , d.divdesc from table(select div from organisation) d
where d.id=1;
--union
cursor c_dept is
select dp.id , dp.deptdesc "Dept Details" from table(select dept from organisation) dp
where dp.dept_div=1;
--union
cursor c_cctr is
select cc.id , cc.cctrdesc "Cctr Details" from table(select cctr from organisation ) cc
where cc.cctr_dept=10;
--union
cursor c_oper is
select op.id , op.operdesc "Oper Details" from table(select oper from organisation) op
where op.oper_cctr=100;
TYPE oper_type IS RECORD
(oper_no NUMBER,
oper_desc VARCHAR(50));
TYPE cctr_type IS RECORD
(cctr_no NUMBER,
cctr_desc VARCHAR(50),
oper_detl oper_type);
TYPE dept_type IS RECORD
(dept_no NUMBER,
dept_desc VARCHAR(50),
cctr_detl cctr_type);
TYPE div_type IS RECORD
(div_no NUMBER,
div_desc VARCHAR2(50),
dept_detl dept_type);
division_rec div_type;
begin
for i_div in c_div%rowcount
loop
exit when c_div%notfound;
division_rec.div_no:=i_div.id;
division_rec.div_desc:=i_div.divdesc;
dbms_output.put_line('Division details = ' || division_rec.div_no || division_rec.div_desc);
--end loop;
for i_dept in c_dept%rowcount
loop
exit when c_dept%notfound;
select dp.id , dp.deptdesc ,
into
division_rec.dept_detl.dept_no, division_rec.dept_detl.dept_desc
from
table(select dept from organisation) dp
where dp.dept_div=division_rec.div_no;
-- division_rec.dept_detl.dept_no:=c_dept.id;
-- division_rec.dept_detl.dept_desc:=c_dept.deptdesc;
dbms_output.put_line('Department details = ' || division_rec.dept_detl.dept_no ||
division_rec.dept_detl.dept_desc);
--end loop;
for i_cctr in c_cctr
loop
exit when c_cctr%notfound;
select cc.id , cc.cctrdesc
into
division_rec.dept_detl.cctr_detl.cctr_no ,
division_rec.dept==_detl.cctr_detl.cctr_desc
from
table(select cctr from organisation ) cc
where cc.cctr_dept=division_rec.dept_detl.dept_no;
-- division_rec.dept_detl.cctr_detl.cctr_no:=c_cctr.id;
-- division_rec.dept_detl.cctr_detl.cctr_desc:=c_cctr.cctrdesc;
dbms_output.put_line('Cost Center details = ' || division_rec.dept_detl.cctr_detl.cctr_no ||
division_rec.dept_detl.cctr_detl.cctr_desc);
--end loop;
for i_oper in c_oper%rowcount
loop
exit when c_oper%notfound;
select op.id , op.operdesc
into
division_rec.dept_detl.cctr_detl.oper_detl.oper_no,
division_rec.dept_detl.cctr_detl.oper_detal.oper_desc
from
table(select oper from organisation) op
where op.oper_cctr=division_rec.dept_detl.cctr_detl.cctr_no;
-- division_rec.dept_detl.cctr_detl.oper_detl.oper_no:=c_oper.id;
-- division_rec.dept_detl.cctr_detl.oper_detal.oper_desc:=c_oper.operdesc;
dbms_output.put_line('Operation details = ' ||
division_rec.dept_detl.cctr_detl.oper_detl.oper_no ||
division_rec.dept_detl.cctr_detl.oper_detal.oper_desc);
end loop;
end loop;
end loop;
end loop;
end;
for i_div in c_div%rowcount
ERROR at line 46:
ORA-06550: line 46, column 14:
PLS-00999: implementation restriction (may be temporary)
ORA-06550: line 46, column 1:
PL/SQL: Statement ignored
New version of PL/SQL bloc
==============================
declare
div number;
divdesc varchar2(100);
divdetails varchar2(100);
dept number;
deptdesc varchar2(100);
deptdetails varchar2(100);
cctr number;
cctrdesc varchar2(100);
cctrdetails varchar2(100);
oper number;
operdesc varchar2(100);
operdetails varchar2(100);
cnt_div number;
cnt_dept number;
cnt_cctr number;
cnt_oper number;
cursor c_div is
select d.id , d.divdesc from table(select div from organisation) d
where d.id=1;
--union
cursor c_dept is
select dp.id , dp.deptdesc from table(select dept from organisation) dp
where dp.dept_div=1;
--union
cursor c_cctr is
select cc.id , cc.cctrdesc from table(select cctr from organisation ) cc
where cc.cctr_dept=10;
--union
cursor c_oper is
select op.id , op.operdesc from table(select oper from organisation) op
where op.oper_cctr=100;
TYPE oper_type IS RECORD
(oper_no NUMBER,
oper_desc VARCHAR(50));
TYPE cctr_type IS RECORD
(cctr_no NUMBER,
cctr_desc VARCHAR(50),
oper_detl oper_type);
TYPE dept_type IS RECORD
(dept_no NUMBER,
dept_desc VARCHAR(50),
cctr_detl cctr_type);
TYPE div_type IS RECORD
(div_no NUMBER,
div_desc VARCHAR2(50),
dept_detl dept_type);
division_rec div_type;
begin
/*select count(*) into cnt_div from table(select div from organisation) d
where d.id=1;*/
for i_div in c_div
loop
exit when c_div%notfound;
division_rec.div_no:=i_div.id;
division_rec.div_desc:=i_div.divdesc;
dbms_output.put_line('Division details = ' || division_rec.div_no || division_rec.div_desc);
--end loop;
/*select count(*) into cnt_dept from table(select dept from organisation) dp
where dp.dept_div=i_div.id;*/
for i_dept in c_dept
loop
exit when c_dept%notfound;
select dp.id , dp.deptdesc
into
division_rec.dept_detl.dept_no, division_rec.dept_detl.dept_desc
from
table(select dept from organisation) dp
where dp.dept_div=division_rec.div_no;
-- division_rec.dept_detl.dept_no:=c_dept.id;
-- division_rec.dept_detl.dept_desc:=c_dept.deptdesc;
dbms_output.put_line('Department details = ' || division_rec.dept_detl.dept_no || division_rec.dept_detl.dept_desc);
--end loop;
/*select count(*) into cnt_cctr from table(select cctr from organisation ) cc
where cc.cctr_dept=division_rec.dept_detl.dept_no;*/
for i_cctr in c_cctr
loop
exit when c_cctr%notfound;
select cc.id , cc.cctrdesc
into
division_rec.dept_detl.cctr_detl.cctr_no , division_rec.dept_detl.cctr_detl.cctr_desc
from
table(select cctr from organisation ) cc
where cc.cctr_dept=division_rec.dept_detl.dept_no;
-- division_rec.dept_detl.cctr_detl.cctr_no:=c_cctr.id;
-- division_rec.dept_detl.cctr_detl.cctr_desc:=c_cctr.cctrdesc;
dbms_output.put_line('Cost Center details = ' || division_rec.dept_detl.cctr_detl.cctr_no || division_rec.dept_detl.cctr_detl.cctr_desc);
--end loop;
/*select count(*) into c_oper from table(select oper from organisation) op
where op.oper_cctr=division_rec.dept_detl.cctr_detl.cctr_no;*/
for i_oper in c_oper
loop
exit when c_oper%notfound;
select op.id , op.operdesc
into
division_rec.dept_detl.cctr_detl.oper_detl.oper_no, division_rec.dept_detl.cctr_detl.oper_detl.oper_desc
from
table(select oper from organisation) op
where op.oper_cctr=division_rec.dept_detl.cctr_detl.cctr_no;
-- division_rec.dept_detl.cctr_detl.oper_detl.oper_no:=c_oper.id;
-- division_rec.dept_detl.cctr_detl.oper_detl.oper_desc:=c_oper.operdesc;
dbms_output.put_line('Operation details = ' || division_rec.dept_detl.cctr_detl.oper_detl.oper_no || division_rec.dept_detl.cctr_detl.oper_detl.oper_desc);
end loop;
end loop;
end loop;
end loop;
end;
declare
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 64
I hope you might have the solutions.
Thanks & Regards
Nihar
Maybe you are looking for
-
I added my husbands new iphone to my itunes acount......all my contacts were on his phone so he delated them and added his own. Now my contacts are on my phone and mine are gone!!! Please tell me I can get them back and how?!?!?!
-
Samsung stratosphere keeps getting stuck in landscape mode?
All of a sudden a couple of days ago my phone started getting stuck in landscape mode, even when the auto rotation was off. I didn't mess with any of the settings to make this happen but sometimes I have to turn the screen on and off a couple of time
-
Are all webpages optimized for Retina Display?
I've noticed on my iPhone 4 that text on every webpage I've been to looks crisp and clear but everything but text like pictures and images still look very pixellated and blurry. Is this how everyones iPhone 4 is?
-
Good morning I'm trying to fix minimum amount for calculation of customer late payment invoive, with different currencies using calculation on open item and not balance sheet , but it doesn't work, in customizing i set this program SAPLFI_INTVW and S
-
Can I change the color of folders in the mail application?
Can I change the color of folders in the mail application?