Insert Into trouble
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
Tags: Database
Similar Questions
-
An animated (gif) file can be inserted into an email, or must it be attached?
An animated gif file can be inserted into an e-mail? It's something that worked when I was using Outlook 2003, but does not work in Outlook 2010. Thunderbird allows a fully animated gif file in an email, or only as an attachment >
It is animated by the recipient; Save as draft or see envoys.
-
When I use the function 'insert into array' index(like 5), it does not work. When I put the index zero, it works, and inserts the new item at the end of the table. ?. ?
Hello
I think the problem is that you have not initialized your table to which you will add an element. You must double clik and adds a number. You can inicialize, only the last element and the other elements will also be inicialized.
Try looking at the photo.
Hope it helps
-
Impossible to insert a 1 d table in a 2D array using "insert into array.
Hi all
I have a very simple problem.
I try to insert a table 1 d as a column in a table 2D using 'insert into array"as stated in image1.
When I try to connect the table 1 d in the "new element/sub-table" terminal I get the error indicated in image2.
According to the help files, I should be able to wire a table of size n-1 this as the 'new item/sub-table"terminal. In other words
I should be able to connect a table 1 d here.
Can someone tell me what I am doing wrong?
Thanks for your help,
Apparently I had converted the table to float in a 'worksheet chain' and I needed to convert it into an array before sending it to 'insert into array.
Discover image3 for more details.
-
Why is my cd not load & play automatically when it is inserted into the media player?
Why is my cd not load & play automatically when it is inserted into the media player?
If you use Windows Vista or Windows 7, try the following:
Click Start, type: AutoPlay
Press enter on your keyboard
Scroll to CDs
Click in the list box
Select an action:
Play audio CD using Windows Media Player.
See:
Windows Media Player Fact not play Audio CD- Roma automatically
Also:
Media Player 12 auto-play when inserting audio CD ... behavior
-
I bought a new SanDisk 4 gb SD card and inserted into my laptop after taking pictures of my camera. When I try to view the files, I get the above error message. It seems that many people have this problem, and other responses, it's a hardware problem - which I don't believe it's in my case, because it works fine in my camera and the Nintendo DSi XL. Any suggestions are appreciated. CHeers, Jherio
I bought a new SanDisk 4 gb SD card and inserted into my laptop after taking pictures of my camera. When I try to view the files, I get the above error message. It seems that many people have this problem, and other responses, it's a hardware problem - which I don't believe it's in my case, because it works fine in my camera and the Nintendo DSi XL. Any suggestions are appreciated. CHeers, Jherio
========================================
If it's your Media Player SDHC card is perhaps not compatible.Try to connect to the camera via a USB cable and see if you can download the files.
Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.
-
An analysis of the USP flash drive is essential to insert into the computer.
I need to scan my Flash USB drive when inserted into my computer. I have Windows XP Home Edition and Microsoft Essentials as my virus prevention program.
Insert your USB key, Point to computer on your Start Menu, right click USB choose scan with MSE. If the computer is not on your Start Menu click Start, all programs, accessories, System Tools, click computer, and you will see your USB key, right click, Scan.
-
How I update my laptop so he sees my micro sd card, I inserted into my laptop, but it didn't come up.
help much appreciated.
Hello
Thank you for visiting Microsoft Community.
According to the description, I understand that the problem with you want to update the laptop so that it can recognize the micro SD card in the computer.
Of course, I understand the inconvenience and will try my best to help you.
In order to understand the issue more clearly, please provide me the following information.
- What exactly happens when you insert the micro SD card in the laptop?
- Do you receive an error message? If Yes, what is the exact error message and the error code?
- What is the brand and model of the laptop?
- How you try to connect the SD card? Is inserting into the card reader on your computer or you are using an external card reader?
- You see an error message or the exclamation point in Device Manager when you connect the SD card?
I suggest you follow the steps how to check for the exclamation point in Device Manager.
- Click on Start and go to Run.
- In the prompt to run it, type devmgmt.msc , and then click OK.
- Device Manager opens.
- In Device Manager, double-click the device category.
- Check the yellow exclamation point against each category.
It is possible that this problem would have occurred if the chipset drivers are not updated in the system.
I would suggest trying the following methods and check if it helps.
Method 1:
I suggest you to update the Chipset drivers on the manufacturer's Web site and check if it helps.
If the problem persists, please follow method 2.
Method 2:
Try to run the built-in troubleshooting utility and check if it works.
Open the hardware and devices Troubleshooter, please follow the steps in the link provided below.
http://Windows.Microsoft.com/en-us/Windows7/open-the-hardware-and-devices-Troubleshooter
Note: If your computer is having problems with a recently installed device or other hardware, try to use the hardware and peripheral troubleshooting tool to solve the problem. It checks the common issues of interest and ensures that a new device or hardware connected to your computer has been installed correctly.
I hope this information is useful.
Please let us know if you need more help, we will be happy to help you.
Thank you.
-
Reflecting an SQL insert into a list
Hello
My app has a list on the main sprite. The data source of this sprite is a class that manages a SQLite DB. There is a function in this class that returns a dataProvider. In the main sprite initializeUI(), I have contactList.dataProvider = contactSQLData.getTableData ();
There's another sprite which is loaded when the application starts and hidden off the screen. When the user presses the button Add, that another sprite slide in with a tweener. The user fills out the form and record visits. I'm passing the list of contacts and contactSQLData to the second sprite through a few affected public objects main sprite after initialization.
When recording button, I run an insert statement, and then tweener the sprite off the screen. Now, back to the main sprite with the list. I want this insert will appear in the list. BTW, the list uses a custom converter in the list of the skin cells.
For inclusion appears, I have tried, in the backup function:
//insert into DB contactSQLData.addData(time.text, opname.text, notes.text); //reload dataProvider and assign to list contactList.dataProvider = contactSQLData.getTableData(); //redraw list on main sprite contactList.invalidate(InvalidationType.ALL, false);
Invalidate the list is the only way I can get to display any type of update, but it seems that to invalidate certain cells. When I create first the DP in the SQL class I add a header in the first place, and then loop through the results of sql and add them to the RFP. The invalidate on the list put the header next to the last line and I just added last and all previous Scriptures are before a new element.
In fact the traces, I see that the items are added to the RFP in the right order, since they came out of the DB. But when the list is invalidated, it seems not all of them are redrawn.
Any ideas?
Thank you
Nick
Hey nwgarner,
the photos have not been approved will not be able to see them until they are. However, I think you could run a problem in the method drawLabel() of the cell display. This is called only once when the list is first created. So what you want to do is update your labels when new data are inserted in the cell renderer. for this, you need to replace the Set data() thus set accessor function. This way your custom CellRenderer will be able to handle the new data when it comes. so to do this, implement the following modified cell rendering engine:
ContactsCellRenderer.as:
package ContactsCellRenderer{ import flash.display.Shape; import flash.text.TextFormat; import flash.text.TextFormatAlign; import qnx.ui.core.Container; import qnx.ui.core.ContainerFlow; import qnx.ui.listClasses.CellRenderer; import qnx.ui.text.Label; public class ContactsCellRenderer extends CellRenderer { private var cellBackground:Shape; private var idLabel:Label; private var timeLabel:Label; private var opnameLabel:Label; private var notesLabel:Label; private var modeLabel:Label; private var LABEL_HEIGHT:int = 30; public function ContactsCellRenderer() { super(); cellBackground = new Shape(); idLabel = new Label(); timeLabel = new Label(); opnameLabel = new Label(); notesLabel = new Label(); modeLabel = new Label(); } override protected function init():void { super.init(); } override protected function onAdded():void { super.onAdded(); removeChild(label); this.cellBackground.graphics.beginFill(0xBBBBBB, 1); this.cellBackground.graphics.drawRect(0, 0, 900, LABEL_HEIGHT); this.cellBackground.graphics.endFill(); this.addChild(this.cellBackground); } override protected function drawLabel():void { trace("drawLabel()"); if (this.data) { var headerFormat:TextFormat = new TextFormat(); headerFormat = new TextFormat(); headerFormat.color = 0xFFFFFF; headerFormat.bold = true; /* * Sometimes this function is called prematurely when there * is no data object available and it is null so we only * do our custom label when there is a data object available */ this.idLabel.width = 30; this.idLabel.x = 0; this.timeLabel.width = 250; this.timeLabel.x = 20;; this.opnameLabel.width = 100; this.opnameLabel.x = this.timeLabel.width + 30; this.notesLabel.width = 100; this.notesLabel.x = this.timeLabel.width + this.opnameLabel.width+ 30; this.modeLabel.width = 100; this.modeLabel.x = this.timeLabel.width + this.opnameLabel.width + this.notesLabel.width + 30; if (this.data.id == "0") { this.timeLabel.format = headerFormat; this.opnameLabel.format = headerFormat; this.notesLabel.format = headerFormat; this.modeLabel.format = headerFormat; } trace("Adding id cell: " + this.data.id); this.addChild(idLabel); this.addChild(timeLabel); this.addChild(opnameLabel); this.addChild(notesLabel); this.addChild(modeLabel); } } override protected function onRemoved():void { trace("onRemoved"); super.onRemoved(); //undo the add child removeChild(this.cellBackground); removeChild(this.idLabel); removeChild(this.timeLabel); removeChild(this.opnameLabel) removeChild(this.notesLabel); removeChild(this.modeLabel); } override public function set data(data:Object):void { super.data = data; if (this.data) { this.idLabel.text = this.data.id; this.timeLabel.text = this.data.time; this.opnameLabel.text = this.data.opname; this.notesLabel.text = this.data.notes; this.modeLabel.text = this.data.mode; } } }}
So now, we update the labels with the new set of data whenever there is a change. everything I think we can leave it intact as is and should not be a problem. so re-apply your cellrenderer and see what happens.
Thanks for the appreication, it is always welcome! im just happy that I can be useful, the playbook needs all it can get its third-party developers like you to succeed. My theory is more quality apps more it will do on its competitors! good luck and let me know how it turns out that!
-
create or replace procedure Dynamic_Table AS
iVal VARCHAR2 (32);
iTemp varchar (200): = ";
sql_stmt VARCHAR2 (200);
l_file1 UTL_FILE. TYPE_DE_FICHIER;
l_file utl_file.file_type;
BEGIN
l_file1: = UTL_FILE. FOPEN ('TEST', 'dinput.txt', 'R');
EXECUTE IMMEDIATE ' CREATE TABLE baseline (Item_ID varchar2 (32))';
Loop
BEGIN
UTL_FILE. GET_LINE (l_file1, iVal);
EXECUTE IMMEDIATE ' insert into baseline values (: ival) "using ival;
EXCEPTION
WHEN No_Data_Found THEN EXIT;
While some OTHER THEN dbms_output.put_line (SQLERRM); * /
END;
end loop;
END;
You are approaching this the wrong way. Create an external table based on the file. External tables are CSV, fixed width data in a queryable table.
You will need to create an oracle directory to put the file in (MY_ORA_DIR) I leave it for you to do, and then perform the following...
create table BASELINE)
ITEM_ID varchar2 (32)
)
EXTERNAL ORGANIZATION
(
TYPE ORACLE_LOADER
THE DEFAULT DIRECTORY MY_ORA_DIR
ACCESS SETTINGS
(
RECORDS DELIMITED BY NEWLINE
LOGFILE "dinput.log".
BADFILE "dinput.bad."
NODISCARDFILE
FIELDS
(
ITEM_ID
)
)
LOCATION ("dinput.txt")
)
REJECT LIMIT UNLIMITED
/
All the dubious records appear in dinput.bad. Dinput.log will give you information.
External tables are read-only, so once you set up your file, you can create editable as a normal table.
create table ITABLE_EDITABLE as
Select * from BASELINE
/
Work done, a few lines of code.
-
"missing the SELECT keyword" error during an insert into the temporary table using the blob value
I'm trying to insert into an oracle temp table using select that retrieves data from a blob field but I get the error: "lack the SELECT keyword.
How we store temporary in oracle result when we make this type of operation (extraction of data in fields and try to load them into a separate table on the fly.?)
with cte as)
Select user_id, utl_raw.cast_to_varchar2 (dbms_lob.substr (PREFERENCES)) as USER my_blob
)
create table new_table as
SELECT user_id,EXTRACTvalue(xmltype(e.my_blob),'/preferences/locale') regional settings
E ETC
----------------------------------------------------------------------------------
BLOB data - value - which is
<? XML version = "1.0" encoding = "ISO-8859-1" ?>
- < Preferences >< time zone > America/New_York < / > zone< displayscheduleinusertimezone > Y < / displayscheduleinusertimezone >< local > Spanish < /locale >< DateFormat > JJ/mm/aaaa < / DateFormat >< timeFormat > hh: mm aaa < / timeFormat >< longformat > Long_01 < / longformat >< doubleformat > Double_01 < / doubleformat >< percentformat > Percentage_01 < / percentformat >< currencyformat > Currency_01 < / currencyformat >< / Preferences >
A WITH clause that must immediately precede the SELECT keyword:
SQL > create table t:
2 with the o as (select double dummy)
3 select * West longitude;
Table created.
-
Insert into... How to do it with a big enough request?
Hello
I want to store the result of this query in a table:
insert into dbsnmp.zetup_iostat (seq_ms, seq_ct, lfpw_ms, lfpw_ct, scat_ms, scat_ct, dpr_ms, dpr_ct, dprt_ms, dprt_ct, prevseq_ct, prevscat_ct, prevseq_tm, prevscat_tm, prevsec, prevlfpw_tm, prevlfpw_ct, prevdpr_ct, prevdpr_tm, prevdprt_ct, prevdprt_tm, prevdpw_ct, prevdpw_tm
prevdpwt_ct, prevdpwt_tm) values (seq_ms, seq_ct, lfpw_ms, lfpw_ct, scat_ms, scat_ct, dpr_ms, dpr_ct, dprt_ms, dprt_ct, prevseq_ct, prevscat_ct, prevseq_tm, prevscat_tm, prevsec, prevlfpw_tm, prevlfpw_ct, prevdpr_ct, prevdpr_tm, prevdprt_ct, prevdprt_tm, prevdpw_ct, prevdpw_tm
prevdpwt_ct, prevdpwt_tm)
Select
Round (seqtm/NULLIF(seqct,0), 2) seq_ms.
Round (seqct/NULLIF(Delta,0), 2) seq_ct.
Round (lfpwtm/NULLIF(lfpwct,0), 2) lfpw_ms.
Round (lfpwct/NULLIF(Delta,0), 2) lfpw_ct.
Round (scattm/NULLIF(scatct,0), 2) scat_ms.
Round (scatct/NULLIF(Delta,0), 0) scat_ct,
Round (dprtm/NULLIF(dprct,0), 2) dpr_ms.
Round (dprct/NULLIF(Delta,0), 2) dpr_ct.
Round (dprttm/NULLIF(dprtct,0), 2) dprt_ms.
Round (dprtct/NULLIF(Delta,0), 2) dprt_ct.
prevseq_ct, prevscat_ct, prevseq_tm, prevscat_tm, prevsec, prevlfpw_tm, prevlfpw_ct
prevdpr_ct, prevdpr_tm, prevdprt_ct, prevdprt_tm, prevdpw_ct, prevdpw_tm
prevdpwt_ct, prevdpwt_tm
Of
(select
sum (decode (event, 'db file sequential read', round(time_waited_micro/1000) - & prevseq_tm_var, 0)) seqtm,.
sum (decode (event, "db-reading of scattered files", round(time_waited_micro/1000) - & prevscat_tm_var, 0)) scattm,.
sum (decode (event, 'parallel writing to log file', round(time_waited_micro/1000) - & prevlfpw_tm_var, 0)) lfpwtm,.
sum (decode (event, 'db file sequential read', round(time_waited_micro/1000), 0)) prevseq_tm,.
sum (decode ("db-reading of scattered files", event, round(time_waited_micro/1000), 0)) prevscat_tm,.
sum (decode (event, 'parallel writing to log file', round(time_waited_micro/1000), 0)) prevlfpw_tm,.
sum (decode (event, 'db file sequential read', total_waits - & prevseq_ct_var, 0)) seqct,.
sum (decode (event, "db-reading of scattered files", total_waits - & prevscat_ct_var, 0)) scatct,.
sum (decode (event, 'parallel writing to log file', total_waits - & prevlfpw_ct_var, 0)) lfpwct,.
sum (decode (event, 'db file sequential read', total_waits, 0)) prevseq_ct,.
sum (decode ("db-reading of scattered files", event, total_waits, 0)) prevscat_ct,.
sum (decode (event, 'parallel writing to log file', total_waits, 0)) prevlfpw_ct,.
sum (decode (event, 'direct path read', round(time_waited_micro/1000) - & prevdpr_tm_var, 0)) dprtm,.
sum (decode ('direct path read', event, round(time_waited_micro/1000), 0)) prevdpr_tm,.
sum (decode (event, 'direct path read', total_waits - & prevdpr_ct_var, 0)) dprct,.
sum (decode ('direct path read', event, total_waits, 0)) prevdpr_ct,.
sum (decode (event, 'Write direct path', round(time_waited_micro/1000) - & prevdpw_tm_var, 0)) dpwtm,.
sum (decode (event, 'Write direct path', round(time_waited_micro/1000), 0)) prevdpw_tm,.
sum (decode (event, 'Write direct path', total_waits - & prevdpw_ct_var, 0)) dpwct,.
sum (decode (event, 'Write direct path', total_waits, 0)) prevdpw_ct,.
sum (decode (event, ' path direct writing temp', round(time_waited_micro/1000) - & prevdpwt_tm_var, 0)) dpwttm,.
sum (decode (' path direct writing temp', event, round(time_waited_micro/1000), 0)) prevdpwt_tm,.
sum (decode (event, ' path direct writing temp', total_waits - & prevdpwt_ct_var, 0)) dpwtct,.
sum (decode (' path direct writing temp', event, total_waits, 0)) prevdpwt_ct,.
sum (decode (event, 'the direct path read temp', round(time_waited_micro/1000) - & prevdprt_tm_var, 0)) dprttm,.
sum (decode (event, "the direct path read temp", round(time_waited_micro/1000), 0)) prevdprt_tm,.
sum (decode (event, 'the direct path read temp', total_waits - & prevdprt_ct_var, 0)) dprtct,.
sum (decode (event, "the direct path read temp", total_waits, 0)) prevdprt_ct,.
Delta to_char (sysdate, 'SSSSS') - & prevsec_var,
to_char(sysdate,'SSSSS') prevsec
Of
v$ system_event
where
test of ('db file sequential read',
"scattered files db reading."
"direct way read temp."
"direct path write temp."
"direct path read."
"Write direct way."
"log file parallel write")
) ;
create table iostat_table)
number of seq_ms
number of seq_ct
number of lfpw_ms
number of lfpw_ct
number of scat_ms
number of scat_ct
number of dpr_ms
number of dpr_ct
number of dprt_ms
number of dprt_ct
number of prevseq_ct
number of prevscat_ct
number of prevseq_tm
number of prevscat_tm
number of prevsec
number of prevlfpw_tm
number of prevlfpw_ct
number of prevdpr_ct
number of prevdpr_tm
number of prevdprt_ct
number of prevdprt_tm
number of prevdpw_ct
number of prevdpw_tm
number of prevdpwt_ct
number of prevdpwt_tm
);
I get
ERROR on line 4:
ORA-00933: SQL not correctly completed command.
When you run the query.
How well do things?
Concerning
3
Delete 'values' of the insert bit.
insert into iostat_table...
Select
-
Salvation of france
Thank you for your intelligent help, but if you don't know about object types and tables of onject, just go your way.
I use 12 c (12.1.0.2) on OEL 6,7 in Virtual box
Here's my use case
drop table envparams;
Drop type envparam_obj;
Drop the params table;
Drop type param_obj;
create or replace type param_obj as an object
(
PName varchar2 (32),
RegExp varchar2 (128).
GetName member function returns a varchar2.
function GetRegexp return varchar2 Member,
Member ToString function returns a varchar2.
procedure Display of Member
);
/
create or replace type body param_obj as
member function GetName return varchar2 is
Start
return (PName);
end;
member function GetRegExp return varchar2 is
Start
return (RegExp);
end;
member function ToString return varchar2 is
OutStr varchar2 (1000);
Start
OutStr: = 'parameter ' | PName;
If (RegExp is not null) then OutStr: = OutStr | ' use control regexp ("|") RegExp | ')'; end if;
return (OutStr |) '.');
end;
Members procedure display is
Start
dbms_output.put_line (self. (ToString());
end;
end;
/
create table param_obj params (key primary pname) object identifier is a primary key;
create an index only params_un01 on params (upper (pname));
insert into values params (new param_obj ("nls_lang", null));
Select * from params;
Select params Ref (p) rparam p where p.pname = 'nls_lang. "
drop table envparams;
Drop type envparam_obj;
create or replace type envparam_obj as an object
(
paramref Ref param_obj,
sys.ANYDATA pValue,
REF. param_obj, GetParamRef member function return
sys.ANYDATA, GetPValue member function return
Member ToString function returns a varchar2.
procedure Display of Member
);
/
create or replace type body envparam_obj as
REF param_obj is back from GetParamRef member function
Start
return (ParamRef);
end;
member function GetPValue return sys.anydata is
Start
return (PValue);
end;
member function ToString return varchar2 is
OutStr varchar2 (200);
TypeCode pls_integer;
ValueType sys.anytype;
Number num.
Str varchar2 (20000);
Dummy Pls_integer;
Start
Select deref (ParamRef). ToString() in double OutStr;
If (PValue is not null) then
TypeCode: = PValue.GetType (ValueType);
case TypeCode
When dbms_types.typecode_number then
Dummy: = PValue.GetNumber (NB);
Str: = to_char (Num);
When dbms_types.typecode_varchar2 then
Dummy: = PValue.GetVarchar2 (Str);
end case;
OutStr: OutStr = | "The value is (' |)" Str | ')';
on the other
OutStr: OutStr = | "The value is (NULL);
end if;
return (OutStr |) '.');
end;
Members procedure display is
Start
dbms_output.put_line (self. (ToString());
null;
end;
end;
/
create the table envparams to envparam_obj;
create or replace procedure as
ThisParamRef ref param_obj;
ThisParam param_obj;
ANYDATA ThisValue;
ThisEnvParam envparam_obj;
Start
SELECT ref (p), value (p), anydata.convertvarchar2('FRENCH_FRANCE.) WE8ISO8859P1 ") in ThisParamRef, ThisParam, ThisValue"
params p WHERE p.PName = 'nls_lang. "
ThisEnvParam: = envparam_obj (ThisParamRef, ThisValue);
ThisEnvParam.Display ();
INSERT INTO envparams
Envparam_obj SELECT (Ref (p), anydata.convertvarchar2('FRENCH_FRANCE.) WE8ISO8859P1'))
OF params p
WHERE p.PName = 'nls_lang. "
end;
declare
Start
test;
end;
test is what gives:
RA-22979: impossible to insert a REF to a view object OU a REF defined by user (translation is below...)
ORA-06512: at "MMN. "TEST", line 16
ORA-06512: at line 3
22979 00000 - "cannot INSERT object REF or REF user-defined view.
* Cause: Attempt to insert a view of the REF or REF object defined by the user in one
Column REF created to store the system generated REF values.
* Action: Make sure that the REF to be inserted is not a view object
or a REF configurable column *.
If I change the test and write:
INSERT INTO envparams values (ThisEnvParam); = > Get the same message
ORA-22979: impossible to insert a REF to a view object OU a REF defined by user
ORA-06512: at "MMN. "TEST", line 16
ORA-06512: at line 3
22979 00000 - "cannot INSERT object REF or REF user-defined view.
* Cause: Attempt to insert a view of the REF or REF object defined by the user in one
Column REF created to store the system generated REF values.
* Action: Make sure that the REF to be inserted is not a view object
or a column defined by the user REF
If I modify the testing and writing
insert into envparams values (envparam_obj (ThisParamref, ThisValue));
; = > Get the same message
ORA-22979: impossible to insert a REF to a view object OU a REF defined by user
ORA-06512: at "MMN. "TEST", line 16
ORA-06512: at line 3
22979 00000 - "cannot INSERT object REF or REF user-defined view.
* Cause: Attempt to insert a view of the REF or REF object defined by the user in one
Column REF created to store the system generated REF values.
* Action: Make sure that the REF to be inserted is not a view object
or a column defined by the user REF
WELL, I'm stuck in the stuckhouse.
How can I make the test work
Thanks again for reading me
Concerning
Michel M - N
The error message gives an indication of what is wrong:
Failed to INSERT the object REF or REF user-defined view
In this case, you have a REF user-defined because you based the table OID of PARAMS on the PK.
Storage of such a REF is possible only if it is worn, as explained in the documentation:
https://docs.Oracle.com/database/121/ADOBJ/adobjadv.htm#ADOBJ7393
Like this:
create the table envparam_obj envparams)
scope for (paramref) params
) ;
or on the existing table:
ALTER table envparams Add (scope (paramref) params);
SQL> INSERT INTO envparams 2 SELECT envparam_obj (ref (p), anydata.convertvarchar2('FRENCH_FRANCE.WE8ISO8859P1')) 3 FROM params p 4 WHERE p.PName = 'nls_lang'; 1 row created. SQL> select t.paramref.getname() from envparams t; T.PARAMREF.GETNAME() -------------------------------------------------------------------------------- nls_lang
-
best approach to block an insert into a table
Hello, I tried to write a trigger before insert Insert block into a table - ideally I want to stop insert instead of the insert and rollback. Can someone help me understand why would always insert the line y data is a trigger to restore? What can be done to stop an insert in addition to what I have done and who does not. Thank you.
Here is what I tried:
SQL> CREATE TABLE t ( testcol VARCHAR2(20)); 2 Table created. SQL> CREATE OR REPLACE TRIGGER bi_t BEFORE INSERT ON t 2 DECLARE 3 PRAGMA AUTONOMOUS_TRANSACTION; 4 BEGIN 5 ROLLBACK; 6 DBMS_OUTPUT.PUT_LINE('ROLLBACK DONE'); 7 END bi_t; 8 / Trigger created. SQL> insert into t values ('1'); SP2-0734: unknown command beginning "insert in..." - rest of line ignored. SQL> insert into t values ('1'); ROLLBACK DONE 1 row created. SQL> select * from t; TESTCOL -------------------- 1
- Rename the table.
- Create a view with the name of the original table, which selects all rows in the renamed table.
- Create an INSTEAD OF trigger on the view that does nothing.
There are variations on this. For example, depending on your exact situation, you might be able to use a synonym to redirect the insert at the sight, rather than change the name of the table.
-
I have two tables (2) RESULT TAB (1)
CREATE TABLE TAB
(
NUMBER OF SNO
A NUMBER,
B THE NUMBER.
NUMBER OF THE SUM
);
CREATE AN ARRAY OF RESULT
(
NUMBER OF SNO
NUMBER OF THE SUM
)
my doubt is:
(1) I want to insert a table TAB, my question is how to insert a column to the SUM using the column A AND B... Here im adding two values of the column and store result in the AMOUNT column.
SNO A B SUM
1 100 150 250
2 300 100 400
I want to like this, it is possible with single insert query?
(2) at the time of the insertion TAB of values that SNO, and the values of table TAB $ insert in the table of RESULTS... is it possible these two inserts at the same time?
in fact, im using another this table.fro TAB and easy to understand I write like that, please solve this problem
First, you post in the wrong forum as this one is only for Oracle's SQL developer tool. So you might ask your question in the general forum of SQL.
Second, you might solve your problems with bind variable:
Insert tab
(sno, a, b, sum)
values
(: SNO,: A: B: A + B :))
You should not use sum as column name because it is a reserved word.
More you cannot insert into two different tables with a single SQL, but you can use PL/SQL to do this:
Start
insert into tab values (: SNO,: A: B: A + B :);)
insert into result values (: SNO,: A + B :);)
end;
If you meet sno from a sequence, you could do something like this:
Start
insert into values tab (seq_sno.nextval,:,: B,: A +: B) return sno in: SNO.
insert into result values (: SNO,: A + B :);)
end;
Hope that helps,
dhalek
Maybe you are looking for
-
Screen of C850 - 1 H 8 satellite flashes and turns off using SSD and win 8
Hello, I bought a C850 - 1 H 8 of Ebuyer and I removed the hard drive installed windows 8 on it and installed my SSD, and then a clean installed Windows 7. The laptop was working perfectly, and then after a little more than a month, the headphone jac
-
How to turn on the lights on a Satellite P300-23V + user guide on CD
I wonder how you turn on the light a SATELLITE P300-23V?I mean the light that show a bar above the touchpad and and the name of the Satellite is too bright.In the manual it says how to do it with the slim remote control, but it's not on this model.I
-
System Restore and security updates
A did the system restore for a March 22, 2010, as Windows Explorer had become deadly slow and I was unable to determine why. Seems fine now. My question is: Do I need to download and install new updates of security for Windows XP (professional sp3) p
-
I just received the last update for my Z2. My camera now has a 23.0.1.A.3.12 firmware. I encountered a problem. Can I transfer is more pictures on SD card through transfer to SD card as storage.
-
Windows Defender won't turn on code 0x800705b4
It is a Windows 7. Not sure if the Defender has never worked, it comes a new old computer to 1 MB... I can uninstall it & how, and reinstall?