ORA-00928
HelloI need to insert data into a table and the values are fetched from a cursor.
Here's the code in part
BEGIN
Select max (current_start_date) in the v_start_date from ods_batch_parameter where mapping_name = 'M_PARTY ';
FOR ut_rec IN ut_cur
LOOP
sqlstr: =.
' select count (case when ods_update_date = 1 then ods_load_date).
Count (case when ods_update_date! = ods_load_date then 1 end).
Count (*)
of ' | ut_rec.Ta | »
where ods_update_date > = "' | v_start_date | » '' ';
-dbms_output.put_line (sqlstr);
Sqlstr EXECUTE IMMEDIATE IN ins, updt, tot.
dbms_output.put_line (ut_rec.ta);
dbms_output.put_line (INS);
dbms_output.put_line (UPDT);
dbms_output.put_line (tot);
*' insert into IIMS_ODS_TABLES_REC_COUNT(:v_column1,:v_column2,:v_column3) *.
the values of ('| ut_rec.ta |) «, » || Ins | «, » || UPDT |') ' ;
EXECUTE IMMEDIATE sqlins using v_column1, v_column2, v_column3;
commit;
dbms_output.put_line (Sqlins);
END LOOP;
It gives an error as follows:
ORA-00928: lack of SELECT keyword
ORA-06512: at the 'ODS '. ODS_REC_COUNT', line 155
ORA-06512: at line 2
I need to the syntax for inserting data by using the syntax of normal in oracle dynamic sql insert*.
This following syntax generates an error
column not allowed here
' insert into IIMS_ODS_TABLES_REC_COUNT (ODS_TABLE_NAME, ODS_INSERT_COUNT,
Values ODS_UPDATE_COUNT) ('| ut_rec.ta |) «, » || Ins | «, » || UPDT |') '
Help, please
Published by: chrys on November 26, 2008 14:59
Published by: chrys on November 26, 2008 15:02
This is because you cannot use bind variables for columns, you need to use:
' insert into IIMS_ODS_TABLES_REC_COUNT (ODS_TABLE_NAME, ODS_INSERT_COUNT, ODS_UPDATE_COUNT)
values ("' | ut_rec.ta |") «, » || Ins | «, » || UPDT |') ' ;
or
' insert into IIMS_ODS_TABLES_REC_COUNT('|| v_column1 ||) «, » || v_column2 | «, » || v_column3 |')
values ("' | ut_rec.ta |") «, » || Ins | «, » || UPDT |') ' ;
Tags: Database
Similar Questions
-
Disqualification - Error exporting to DB: ORA-00928 missing SELECT
HelloI use v12.1.3.0.0 of the Disqualification and have created evidence very basic process of concept that takes as input a comma-demilited of files through the process of the player and then with a writing processor to write data staged entry.
I then try to export the data showcased in the corresponding table in the database, but get the following error message:
"xxxxxx failed: writing problem Insert batch of database: ORA-00928: lack of SELECT key word."
A single CSV file with 3 fields and across the database contains the input staging file data, all I have in the schema is a single table that I write for. I can connect to my DB store data target in Disqualification without any problem.
Does anyone have any ideas as to what could be the cause? Reading upward on this error gives to think it is to SELECT key missing with the word in a CREATE VIEW statement, but I don't know where or why she strives to create a view.
Any help would be appreciated.
Hello
-Your export write in an existing table or create a new table (as configured in the export task definition)?
-If the former, that export option do you use (as configured in the work using export)? The three options assuming a DB target are 'Erase existing data and insert","add to current data' and 'Replace records with the help of the primary key'.
Note If just run the export as a stand-alone task rather than in a work (for example, right-click, executed in the tree) it will run in mode Delete and Insert.
It looks a bit like the export may be trying to replace the records by primary key, but can not detect the PK in the target table to select the records to be deleted before insertion (Disqualification does not 'Update' statements currently - this is why the table must be an intermediate table autonomous or similar without FK constraints or the permission issues that would prevent the Disqualification deleting records in this mode).
Kind regards
Mike
-
WITH ACE translated by ORA-00928: lack of SELECT keyword
Hi allWe run on Oracle 10 g. The following script is translated by ORA-00928: lack of keyword SELECT. Any ideas what causes this error? Two statements by operating by themselves, complete with success "select".
[code]
WITH A1 AS
WITH A1 (SELECT MIN (VAPS_RPT_INTV_DMSN. INTV_DT), VAPS_RPT_INTV_DMSN. RPT_ID, VAPS_RPT_INTV_DMSN. RPT_INTV_ID OF THE APS. VAPS_RPT_INTV_DMSN, APS. VAPS_RPT_CL_INTV_DMSN WHERE APS. VAPS_RPT_INTV_DMSN. RPT_INTV_ID = APS. VAPS_RPT_CL_INTV_DMSN. RPT_CL_INTV_ID AND VAPS_RPT_INTV_DMSN. HM_VST_IND = '1' GROUP OF VAPS_RPT_INTV_DMSN. RPT_ID, VAPS_RPT_INTV_DMSN. RPT_INTV_ID ORDER BY VAPS_RPT_INTV_DMSN. RPT_ID, VAPS_RPT_INTV_DMSN. RPT_INTV_ID) A2 AS (SELECT DISTINCT TAPS_REFERRALS_FACT. RPT_ID, TAPS_REFERRALS_FACT. DB2_UPDATE_DT, TAPS_REFERRALS_FACT. RPT_RECV_DT OF THE APS. TAPS_REFERRALS_FACT, APS. VAPS_RPT_CL_DMSN, APS. VAPS_RPT_CL_INTV_DMSN WHERE VAPS_RPT_CL_DMSN. RPT_ID = TAPS_REFERRALS_FACT. RPT_ID AND VAPS_RPT_CL_INTV_DMSN. RPT_CL_ID = VAPS_RPT_CL_DMSN. RPT_CL_ID AND TAPS_REFERRALS_FACT. EMRG_IND = '1') SELECT * FROM A1, A2 WHERE A1. RPT_INTV_ID = A2. RPT_INTV_ID
[/ code]
Thank you
Seyed
Right, A2 is not column named RPT_INTV_ID.
SY.
-
Could not commit: ORA-00928: lack of creating the table SELECT keyword
Hello guys.
I tried to create the table with web interface on oracle 11g.
I just follow this path on interface: schema-> table-> create-> standard (lot organized)-> SQl select on (set using the)->
and I just use these scripts to create the table:
CREATE TABLE suppliers
(the number (10) of supplier_id not null,)
supplier_name varchar2 (50) not null,
Contact_Name varchar2 (50)
);
but this error occurred: failed to commit: ORA-00928: lack of SELECT key word!
Please lock on this picture for more information: http://s17.postimg.org/kgoumzmvz/attachment.jpg
could you help me please?
and I could not find any manual for working with the web interface in oracle 11g.
Please give me somesources to start.
Thank you.1003778 wrote:
Thank you sybrand_b
but I already read this document.
Unfortunately, there is nothing on the creation of table with sql scripts in this document!and I really don't understand how to create table with SQL commands! My question has not yet been answered.
you please give me little details about it?
for example, how can create table using this sql command:CREATE TABLE suppliers
(the number (10) of supplier_id not null,)
supplier_name varchar2 (50) not null,
Contact_Name varchar2 (50)
);Thank you.
Edited by: 1003778 may 3, 2013 11:43
When you got to the CREATE TABLE screen, you have selected "set using the--> SQL.
Did you notice in the window that appears, just above this entry field is this text: "enter a SQL * select * statement below.» ' + This query results will be used to fill the table with Canada.* + "(underlining)
And hip, just to the left of this field is this text: «CREATE TABLE AS»He tries to build a ' CREATE TABLE AS SELECT... ». Creates a table with the same structure as the table in which you SELECT and fills with the results of this SELECT '. With your entry, you create a CREATE TABLE AS CREATE TABLE to read statement...
If you want to create your tables with a simple CREATE TABLE command, go to sqlplus and do it. You want to have a graphical interface to help build a simple CREATE table, when you get to the CREATE TABLE page, just to stay there with the default "use Define-> column specification." If you want, after completing "build" your table specification here, you will have a "Show sql" option to show you the actual sql statement that will be executed to create your table.
-
ORA-00928: lack of SELECT keyword
Hello
My version of oracle 9i, I need to use a dynamic array
I use the query but I'm below receive the error-ORA-00928: lack of SELECT keyword
declare
o_error_message VARCHAR2 (500);
l_query varchar2 (2000);
HEADER_TABLE VARCHAR2 (30);
BEGIN
Select TABLE_NAME in HEADER_TABLE
from sys.all_tables
where
Upper (table_name) = Upper ('cd_alloc_header_conv');
for r_allocconv in
(SELECT t.ORDER_NO
Of
shconv. CD_ORDER_CONV_TRACK t
WHERE
t.RMS_update_status = 'Y' AND
t.ALLOC_UPDATE_STATUS =' only)
loop
l_query: ='(insert en shconv.) CD_ALLOC_HDR_ACT_CONV (ALLOC_NO,
ORDER_NO,
WH,
SKU,
STATUS,
ALLOC_DESC,
PO_TYPE,
ALLOC_METHOD,
RELEASE_DATE,
ALLOC_TYPE,
ALLOC_RIB_STATUS,
CREATED_BY,
CREATE_DATE,
UPDATED_BY,
UPDATE_DATE,
CREATE_PGM_NAME,
ROW_ID,
EXCEPTION_DETAILS,
CONV_UPDATED_STATUS) select * from shconv.' | HEADER_TABLE | "WHERE order_no =' | r_allocconv.order_no |') ' ;
run immediately l_query;
END LOOP;
EXCEPTION
WHILE OTHERS THEN
o_error_message: = "error in CD_ALLOC_CONV_MAIN" | substr (SQLERRM, 1, 250);
dbms_output.put_line (o_error_message);
END;
ORA-00928: lack of SELECT keyword
Please suggestHello
990047 wrote:
...
l_query: ='(insert en shconv.) CD_ALLOC_HDR_ACT_CONV (ALLOC_NO,...
CONV_UPDATED_STATUS) select * from shconv.' | HEADER_TABLE | "WHERE order_no =' | r_allocconv.order_no |') ' ;
I don't think you want to Try parentheses
l_query := 'insert into shconv.CD_ALLOC_HDR_ACT_CONV(ALLOC_NO, ... CONV_UPDATED_STATUS) select * from shconv.' || HEADER_TABLE ||' WHERE order_no=' ||r_allocconv.order_no;
I wonder if you have the best table design for what you need.
Apparently, you have mulitple header_tables, who are all pretty similar. Would it not be simpler if you just had a header_table, with a column that distinguishes the lines that are now in separate tables? Her you wouldn't need dynamic SQL code at all. This work would be much simpler, more efficient and more robust.I hope that answers your question.
If this isn't the case, after a complete test script that people can run to recreate the problem and test their ideas. -
ORA 00928: missing Select keyword.
Hi all
I get an error when executing the following command
Sélectionnez a.cost_price,d.pvms_no,d.nomenclature,a.item_id,a.stock_id,a.closing_stock comme stock_qty,a.closing_stock*a.cost_price comme valeur, (a.closing_stock*a.cost_price) * 100 comme per,SUM((b.closing_stock*b.cost_price)*100) comme cum de store_item_batch_stock a, store_item_batch_stock b, mas_store_item d où a.item_id=d.item_id et a.cost_price > = b.cost_price GROUP BY a.cost_price union
*
ERROR on line 1:
ORA-00928: lack of SELECT keywordthe clause "group by" must have more values, all the columns that are not in Group functions:
http://docs.Oracle.com/CD/E17952_01/refman-5.1-en/group-by-functions.htmlselect a.cost_price, d.pvms_no, d.nomenclature, a.item_id, a.stock_id, a.closing_stock as stock_qty, a.closing_stock*a.cost_price as value, (a.closing_stock*a.cost_price)*100 as per, SUM((b.closing_stock*b.cost_price)*100) as dum from store_item_batch_stock a, store_item_batch_stock b, mas_store_item d where a.item_id=d.item_id and a.cost_price >= b.cost_price GROUP BY a.cost_price, d.pvms_no, d.nomenclature, a.item_id, a.stock_id, a.closing_stock
-
ORA-00928: lack of keyword SELECT when you create a trigger
Hello
I am trying to create a trigger that is simple for the purpose of verification as below:
This compiles with warning. When I check the warning, he said:CREATE OR REPLACE TRIGGER customer_audit before insert or update or delete on CUSTOMER for each row BEGIN if :old.cname is null and :new.cname is not null or :old.cname is not null and :new.cname is null or :old.cname != :new.cname THEN INSERT INTO audit_table (:old.cname, :new.cname, null, 'cname'); COMMIT; ENDIF; end;
Do not know how to SELECT is part of what I'm trying to do here, or miss me something of totally. Help, please. Thank you very much.TRIGGER customer_audit compiled Warning: execution completed with warning 3/32 PL/SQL: ORA-00928: missing SELECT keyword 3/7 PL/SQL: SQL Statement ignored
Change ENDIF; in END IF; and try again...
-
Error (74,34): PL/SQL: ORA-00928: falta the word clave SELECT
INSERT SHOW ME BECAUSE AN ERROR ORA-00928: WHEN I AM IN COMPLIANCE WITH THE SINTASIX
create or replace
Procedure metodo_inventario (tipo_inventario varchar2)
As
number of;
date of pl_fecha_factura;
number of pl_numero_factura;
pl_id_tp_movimiento nucreate or replace
Procedure metodo_inventario (tipo_inventario varchar2)
As
number of;
date of pl_fecha_factura;
number of pl_numero_factura;
number of pl_id_tp_movimiento;
number of pl_id_producto;
number of pl_cantidad;
number of pl_vlr_unitario;
number of pl_vlr_vairable;
number of pl_vlr_peps;
number of pl_vlr_upes;
number of;
number of;
Begin
pl_vlr_promedio: = 0;
pl_vlr_peps: = 0;
pl_vlr_upes: = 0;
: = 0 ;
: = 0 ;
-> primero is crea una tabla auxiliar of facturas...
/ * Start
create the table as
Select *.
of c_factura;
ALTER TABLE
ADD ("ESTADO" DEFAULT NUMBER 1 NOT NULL);
end; * /
If (tipo_inventario = '% PEP') then
loop
Selección - of the first factura...
If (tipo_movimiento = 'COMPRA %') then
Select min (FECHA_FACTURA)
min (NUMERO_FACTURA)
in pl_fecha_factura, pl_numero_factura
of
where State = 1;
Select FECHA_FACTURA
NUMERO_FACTURA
ID_TP_MOVIMIENTO
ID_PRODUCTO
AMOUNT - amount
VLR_UNITARIO - vlr law
, (AMOUNT * VLR_UNITARIO)-total of vlr
-, AMOUNT - total, und-> este to hace a select aside para sumar...
-, (AMOUNT * VLR_UNITARIO)-total, vlr-> este to hace a select aside para sumar...
IN pl_fecha_factura
pl_numero_factura
pl_id_tp_movimiento
pl_id_producto
pl_cantidad
pl_vlr_unitario
pl_vlr_variable
of
where NUMERO_FACTURA = pl_numero_factura
and State = 1;
Select the amount, vlr_unitario
in pl_cantidad, pl_vlr_unitatrio
of
where State = 1
and numero_factura = pl_numero_factura;
estado set update = 0
where numero_factura = pl_numero_factura;
insert into c_inventario_final ('FECHA_FACTURA', ID_TIPO_MOVIMIENTO,
VLR_UNITARIO, E_CANTIDAD_PRODUCTO, E_VLR_FACTURA, S_CANTIDAD_PRODUCTO.
S_VLR_FACTURA, IF_CANTIDAD, IF_VLR, ESTADO_FACTURA) values ('pl_fecha_factura',
pl_numero_factura, pl_id_tp_movimiento, pl_id_producto, pl_cantidad,
pl_vlr_unitario, pl_vlr_variable, (pl_cantida +), (pl_vlr_peps + pl_vlr_variable);
end if;
end loop;
exception
while others then
dbms_output.put_line (SQLERRM);
-> PROCEDURE OF GENERACIÓN INVENTARIO MEOTDOS...
end;
House;
number of pl_id_producto;
number of pl_cantidad;
number of pl_vlr_unitario;
number of pl_vlr_vairable;
number of pl_vlr_peps;
number of pl_vlr_upes;
number of;
number of;
Begin
pl_vlr_promedio: = 0;
pl_vlr_peps: = 0;
pl_vlr_upes: = 0;
: = 0 ;
: = 0 ;
-> primero is crea una tabla auxiliar of facturas...
/ * Start
create the table as
Select *.
of c_factura;
ALTER TABLE
ADD ("ESTADO" DEFAULT NUMBER 1 NOT NULL);
end; * /
If (tipo_inventario = '% PEP') then
loop
Selección - of the first factura...
If (tipo_movimiento = 'COMPRA %') then
Select min (FECHA_FACTURA)
min (NUMERO_FACTURA)
in pl_fecha_factura, pl_numero_factura
of
where State = 1;
Select FECHA_FACTURA
NUMERO_FACTURA
ID_TP_MOVIMIENTO
ID_PRODUCTO
AMOUNT - amount
VLR_UNITARIO - vlr law
, (AMOUNT * VLR_UNITARIO)-total of vlr
-, AMOUNT - total, und-> este to hace a select aside para sumar...
-, (AMOUNT * VLR_UNITARIO)-total, vlr-> este to hace a select aside para sumar...
IN pl_fecha_factura
pl_numero_factura
pl_id_tp_movimiento
pl_id_producto
pl_cantidad
pl_vlr_unitario
pl_vlr_variable
of
where NUMERO_FACTURA = pl_numero_factura
and State = 1;
Select the amount, vlr_unitario
in pl_cantidad, pl_vlr_unitatrio
of
where State = 1
and numero_factura = pl_numero_factura;
estado set update = 0
where numero_factura = pl_numero_factura;
insert into c_inventario_final ('FECHA_FACTURA', ID_TIPO_MOVIMIENTO,
* VLR_UNITARIO, E_CANTIDAD_PRODUCTO, E_VLR_FACTURA, S_CANTIDAD_PRODUCTO, *.
* S_VLR_FACTURA, IF_CANTIDAD, IF_VLR, ESTADO_FACTURA) values ('pl_fecha_factura', *)
* pl_numero_factura, pl_id_tp_movimiento, pl_id_producto, pl_cantidad, *.
* pl_vlr_unitario, pl_vlr_variable, (pl_cantida +), (pl_vlr_peps + pl_vlr_variable); *
end if;
end loop;
exception
while others then
dbms_output.put_line (SQLERRM);
-> PROCEDURE OF GENERACIÓN INVENTARIO MEOTDOS...
end;
THANK ME THAT COLLABORATE WITH THE CORRECTION OF THIS ERROR...
THANK YOU, GOOD DAY...
REYNEL MARTINEZ SALAZARHola Amigo,
Como Estes?
Buena NocheIt's all the Spanish I know (almost) :)
If you can translate your English error could be useful in the meantime let me brush up on my Spanish language ;)
On the second opinion, your column name insert why there quotes around it?
try to set it toinsert into c_inventario_final(FECHA_FACTURA, ID_TIPO_MOVIMIENTO, /* quotes removed*/ VLR_UNITARIO, E_CANTIDAD_PRODUCTO, E_VLR_FACTURA, S_CANTIDAD_PRODUCTO, S_VLR_FACTURA, IF_CANTIDAD, IF_VLR, ESTADO_FACTURA) values ('pl_fecha_factura', pl_numero_factura, pl_id_tp_movimiento, pl_id_producto, pl_cantidad, pl_vlr_unitario, pl_vlr_variable, (pl_cantida+pl_cant_aux), (pl_vlr_peps+pl_vlr_variable)
See you soon!
BobinPublished by: Buga on November 15, 2009 18:31
-
ORA-00928: IMMEDIATE ' INSERT INTO DIST_TABLE
Hello
I'm trying to insert a value into a temporary table in a stored procedure, and I get the error ora-00928
Here is the code I use to insert
EXECUTE IMMEDIATE ' INSERT IN DIST_TABLE (: DIST_LIST_EMAIL_NAME) ' USING dist_list_name;
Please help me solve the problem
Thanks in advance
Concerning
DeepakHello
Looks like the INSERT syntax incorrect.
What happens when you try:execute immediate 'insert into dist_table (your_column_name) values ( :dist_list_email_name)' using dist_list_name;
Edit
Why you use dynamic sql here anyway?
Looks like you can do in a single SQL statement.Published by: hoek on 2 Sep, 2009 12:14
-
Hi all
I'm trying to implement instead of the notion of trigger in oracle. Below is my code
create or replace view insteadtrigger as
instead of inserting it on emp_dept_view
create or replace view emp_dept_view as
Select d.department_id,
d.dept_name,
Select
departments d, employees e
where e.department_id = d.department_id
declare
v_department_id departments.department_id%type;
Start
Select department_id in v_department_id
departments where department_id =: NEW.department_id;
When no data found then
INSERT INTO employees (employe_id, last_name, department_id)
VALUES (emp_sequence.nextval,: new.last_name, v_department_id);
END insteadtrigger;
"I m getting the error"
Error from line: 12 in order.
create or replace view insteadtrigger as
instead of inserting it on emp_dept_view
declare
v_department_id departments.department_id%type
Command line error: column 13: 1
Error report-
SQL error: ORA-00928: lack of SELECT keyword
00928 00000 - 'lack the SELECT keyword'
* Cause:
* Action:
Variable binding 'NEW' is NOT DECLARED
anonymous block filled
Can you people help me fix this error
I told you that delete 'UNDER '.
-
The interface when the insertion error
Hello world
I have the script with several variables because I need to run several queries.
I have a table with a primary key + a column for each variable within the scenario of ODI.
The ODI process must be run once a month and create one record in this table each time.
So, I've created an interface in the ODI scenario. I filled these variables destination data store. I have no other stores data as a source.
I use IKM SQL command append.
During the execution of this interface, I get the following error:
In step Insert flow in I$ table I get: java.sql.SQLSyntaxErrorException: ORA-00928: lack of SELECT keyword
The code in this step is:
insert into NLANGAI.II_ORG_DATOS_ACTIVIDAD (
)
Select Of where (1 = 1) I don't know how to solve this problem, or if it's the best way to do what I want.
Thanks in advance
Hello 956682,
Your explanation is a bit confusing, I think you mixed "ODI scénario" with another ODI concept, maybe package or even project (although data warehouses are not stored at the project level). Could you use specific terms of ODI?
I also suspect that you are working with ODI 11 g here.
Why not use just an ODI procedure to load your table target that you don't have a real data source? I think that it is not a good idea to use an interface here because you would have to use a workaround to make it work.
Kind regards
JeromeFr
-
Cannot insert date values using several insert in SQL option
Hi all
I'm trying to insert the date in the table I created using the code mentioned below
Insert into TRX
('& Trx_ID ', "& amount',' & account_no', ' & dot");
Enter the field value: 1
Enter the value of the quantity: 2000
Enter the value of account_no: 1001
Enter the value corresponding to point: February 10, 13
After you enter the data, I get the error,
2 old: ('& Trx_ID ', "& amount',' & account_no', ' & dot")
2 new: ('1 ', '2000', ' 1001', February 10, 13')
('1 ', '2000', ' 1001', February 10, 13')
*
ERROR on line 2:
ORA-00928: lack of SELECT keyword
Kindly help me to find the error in my code.
Thank you...
put a key word VALUES before your brackets
Insert... values)
HTH
-
Hi all
It is a strange question that I am. I'm parsing XML and fill my paintings based on XML
Here is my first code
with sample_data as (SELECT XMLType(xml_input_file) xmldoc FROM BIBIN_XML_TABLE WHERE file_id = 9) SELECT record_id , tab_name , property_name ,property_value FROM ( select Student1.record_id record_id ,'Students' tab_name , Student2.property_name PROPERTY_NAME ,Student2.property_value PROPERTY_VALUE from sample_data t , xmltable( '/StudentsImport/Students/Student' passing t.xmldoc columns record_id for ordinality , properties xmltype path '*' ) Student1 , xmltable( '*' passing Student1.properties columns property_name varchar2(30) path 'local-name(.)' , property_value varchar2(30) path '.' ) Student2 UNION ALL select teacher1.record_id record_id ,'teacher' tab_name , teacher2.property_name PROPERTY_NAME ,teacher2.property_value PROPERTY_VALUE from sample_data t1 , xmltable( '/StudentsImport/teachers/teacher' passing t1.xmldoc columns record_id for ordinality , properties xmltype path '*' ) teacher1 , xmltable( '*' passing teacher1.properties columns property_name varchar2(30) path 'local-name(.)' , property_value varchar2(30) path '.' ) teacher2)
It works fine and I get all my necessary files.
However, when I try to insert data into a table, by adding
with sample_data as (SELECT XMLType(xml_input_file) xmldoc FROM BIBIN_XML_TABLE WHERE file_id = 9) INSERT INTO xml_splitter SELECT record_id , tab_name , property_name ,property_value FROM ( select Student1.record_id record_id ,'Students' tab_name , Student2.property_name PROPERTY_NAME ,Student2.property_value PROPERTY_VALUE from sample_data t , xmltable( '/StudentsImport/Students/Student' passing t.xmldoc columns record_id for ordinality , properties xmltype path '*' ) Student1 , xmltable( '*' passing Student1.properties columns property_name varchar2(30) path 'local-name(.)' , property_value varchar2(30) path '.' ) Student2 UNION ALL select teacher1.record_id record_id ,'teacher' tab_name , teacher2.property_name PROPERTY_NAME ,teacher2.property_value PROPERTY_VALUE from sample_data t1 , xmltable( '/StudentsImport/teachers/teacher' passing t1.xmldoc columns record_id for ordinality , properties xmltype path '*' ) teacher1 , xmltable( '*' passing teacher1.properties columns property_name varchar2(30) path 'local-name(.)' , property_value varchar2(30) path '.' ) teacher2
I get an error message saying ORA-00928: lack of SELECT key word. Are there some problems with the insert in and union all?
Correct me if I'm wrong.
Thank you
B1
B1,
You got. Insert syntax is a little different using the clause. He is asked to SELECT just after code below
WITH sample_data AS
(SELECT XMLType (xml_input_file) FROM BIBIN_XML_TABLE WHERE file_id xmldoc = 9
)
SELECT - It expects SELECT here and the reason why you got the error.
Try code below.
INSERT INTO xml_splitter
WITH sample_data AS
(SELECT XMLType (xml_input_file) FROM BIBIN_XML_TABLE WHERE file_id xmldoc = 9
)
SELECT record_id
table_name,
property_name,
name
Of
(SELECT Student1.record_id record_id,
Table_name "students."
Student2.property_name PROPERTY_NAME,
Student2.property_value name
OF sample_data t,.
XMLTable ("/ StudentsImport/students/pupils ' by the way the ordinalite of FOR record_id columns t.xmldoc, xmltype property path ' *') Student 1.
XMLTable (' * ' from Student1.properties of property_name VARCHAR2 columns (30) path 'local - name (.)', name VARCHAR2 (30) path '.') Student2
UNION ALL
SELECT Teacher1.record_id record_id;
table_name 'Professor ',.
teacher2.property_name PROPERTY_NAME,
teacher2.property_value name
OF sample_data t1,.
XMLTable (' / StudentsImport/teachers/teachers "from the ordinalite of FOR record_id columns t1.xmldoc, xmltype property path ' *') teacher1,.
XMLTable (' * ' in passing teacher1.properties property_name VARCHAR2 columns (30) path 'local - name (.)', name VARCHAR2 (30) path '.')
) teacher2
PS: The initial brackets I put just before Teacher2 is always necessary, I guess. You can tell it better
Ishan
-
Help with a basic trigger to capture OS_USER
Here are the trigger and it doesn't - help much appreciated
CREATE OR REPLACE TRIGGER trg_master_tab_aft AFTER INSERT OR UPDATE OR DELETE ON master_tab REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW DECLARE BEGIN IF INSERTING THEN INSERT INTO master_tab_hst values (:NEW.col1, :NEW.OSUSER := SELECT SYS_CONTEXT('USERENV', 'OS_USER') FROM dual ,'I' ,SYSDATE); ELSIF UPDATING THEN INSERT INTO master_tab_hst (:NEW.col1, :NEW.OSUSER := SELECT SYS_CONTEXT('USERENV', 'OS_USER') FROM dual ,'U' ,SYSDATE); ELSIF DELETING THEN INSERT INTO master_tab_hst (:OLD.col1, :NEW.OSUSER := SELECT SYS_CONTEXT('USERENV', 'OS_USER') FROM dual ,'D' ,SYSDATE); END IF; EXCEPTION WHEN OTHERS THEN -- Consider the error and then re-raise RAISE; END ;
Srini Ramaswamy wrote:
Jeenesh, now am getting a different error - apologies for having so stickyI'm not coding for a living; :)
TRIGGER INVTST.TRG_MASTER_TAB_AFT On line: 12 PL/SQL: ORA-00928: missing SELECT keyword
SQL> CREATE OR REPLACE TRIGGER trg_master_tab_aft 2 before INSERT OR UPDATE OR DELETE 3 ON master_tab 4 REFERENCING NEW AS NEW OLD AS OLD 5 FOR EACH ROW 6 DECLARE 7 lc_osuser varchar2(100); 8 BEGIN 9 lc_osuser := SYS_CONTEXT('USERENV', 'OS_USER'); 10 IF INSERTING THEN 11 INSERT INTO master_tab_hst values (:NEW.col1, 12 lc_osuser 13 ,'I' 14 ,SYSDATE); 15 elsiF UPDATING THEN 16 INSERT INTO master_tab_hst values (:NEW.col1, 17 lc_osuser 18 ,'U' 19 ,SYSDATE); 20 ELSIF DELETING THEN 21 INSERT INTO master_tab_hst values(:old.col1, 22 lc_osuser 23 ,'D' 24 ,SYSDATE); 25 END IF; 26 EXCEPTION 27 WHEN OTHERS THEN 28 -- Consider the error and then re-raise 29 RAISE; 30 END ; 31 / Trigger created. SQL> insert into master_tab values(1); 1 row created. SQL> update master_tab set col1=2; 1 row updated. SQL> delete from master_tab; 1 row deleted. SQL> select * from master_tab_hst; COL1 COL2 C DT ---------- ------------------------------ - --------- 1 D-219015333 I 05-APR-13 2 D-219015333 U 05-APR-13 2 D-219015333 D 05-APR-13
-
Top of page application of N as a point of view
Hello
Oracle 10g
Created the following query using the explanation in the following article;
http://www.Oracle.com/technetwork/issue-archive/2007/07-Jan/o17asktom-093877.html specifically under the heading "Top - N queries by SOMETHING"
The query above works without any problem.BREAK ON cell , plot_number skip 1 SELECT * FROM (SELECT cell , plot_number , tree_height , dense_rank() over (partition BY plot_number order by tree_height DESC)drnk FROM jip_recovery ) WHERE drnk <= 3 AND tree_height IS NOT NULL ORDER BY cell, plot_number, tree_height DESC ;
I now want to put this request in a view, but I get the following error;
Is it possible to put this type of query in a view?Error starting at line 1 in command: CREATE OR REPLACE FORCE VIEW top_three AS BREAK ON cell , plot_number skip 1 SELECT * FROM (SELECT cell , plot_number , tree_height , dense_rank() over (partition BY plot_number order by tree_height DESC)drnk FROM jip_recovery ) WHERE drnk <= 3 AND tree_height IS NOT NULL ORDER BY cell, plot_number, tree_height DESC Error at Command Line:2 Column:2 Error report: SQL Error: ORA-00928: missing SELECT keyword 00928. 00000 - "missing SELECT keyword" *Cause: *Action:
BenThere is a difference between SQL, PL/SQL & SQL * more.
What is valid in one is not necessarily valid in all the others.
BREAK is only valid in SQL * more.
Maybe you are looking for
-
My contacts are gone after changing computers
Hello, I have changed my PC and my contacts passed. Is not everything. In the past I had this problem and resolved the oniline support help, but now I can't find a way to contact online support. -J' I need my contacts, advice what I should do?
-
Safari does not load some sites
I just got a brand new iMac 27 "and after a few weeks, Safari seems not to want to take care of some sites, Wordpress.com in particular and now Google Mail, Twitter, the blue loading bar in the area address gets about a quarter of the responsible way
-
I try to call this labview gc.exe file. This file name is another program that involves solving an optimization problem. I don't think that my program requires all memory... can someone help me with this? Thank you!
-
Win 7 Home Premium I have the product key for Win 7 Home Premium OA on laptop - I need to re - install due to virus, how can I get a copy?
-
ESXi version: 5.1.0 1483297vShpere the Client version: 5.1.0 1471691recently added some additional linux VM to test, linuxmint 17.2 and 17.3 x 64 versions.I went here, https://packages.VMware.com/tools/ESX/index.html to download an iso and got then c