By selecting the table with UDT columns
Hello!I have:
create type j_t as object (
num number,
str varchar2(10)
);
create table j_table (
ident number,
j j_t
);
insert into j_table (ident, j) values (1, j_t(1, 'one'));
How can I select from table j_table to the output as:ident num str
----- --- ---
1 1 one
Is there something similar to ' SELECT * FROM ' for use with objects?
You can create an additional array type, for example j_t_tab:
SQL> create type j_t as object (
num number,
str varchar2(10)
)
/
Type created.
SQL> create type j_t_tab as table of j_t
/
Type created.
SQL> create table j_table (
ident number,
j j_t
)
/
Table created.
SQL> insert into j_table (ident, j) values (1, j_t(1, 'one'))
/
1 row created.
SQL> select ident, t.* from j_table j, table(j_t_tab(j)) t
/
IDENT NUM STR
---------- ---------- ---------------
1 1 one
1 row selected.
?
Tags: Database
Similar Questions
-
generate the table with a column of numbers from 1 to 999999999
Hi all, I'm about to generate the table like this:
Select 1 double t
Union of all the
Select 2 double t
Union of all the
Select 3 t double
But I need up to 999999999. Could you please find more simple decision?858774 wrote:
But I need up to 999999999. Could you please find more simple decision?Don't know exactly what you are looking for, but if you want to just set the number from 1 to 999999999, query below would:
select level from dual connect by level <999999999;
Vivek L
-
GetLength errors on CLOB. Retrieves the size of a table with CLOB columns
Hello
I try to find the size of a CLOB to a table column and get the error
PLS-00306: wrong number or types of arguments in the call to "GETLENGTH.
When you try to use dbms_lob.getlength. Here is the code
declare
number num.
Start
for rec in (select xmlupload from FILE_TABLE where file_table_id = 33635) loop
NUM: = dbms_lob.getLength (rec.xmlupload);
end loop;
dbms_output.put_line (num);
end;
Database version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
I'm actually trying to find the size of a table with CLOB columns, is there an easy way to do this Besides using getlength and without having to contact the Administrators (they are outsourced)?It works fine on my computer, the version is also 10g.
SQL> declare 2 num number; 3 begin 4 for rec in (select cntnt from ims_toms_msge where rownum<3) loop 5 num := dbms_lob.getLength(rec.cntnt); 6 dbms_output.put_line(num); 7 end loop; 8 9 end; 10 / 3837 3837 PL/SQL procedure successfully completed.
You should check if xmlupload is the CLOB data type.
In addition, if you just want to get the CLOB size, you can use LENGTH() as well, you will get the same result;SQL> select length(cntnt), dbms_lob.getLength(cntnt) from ims_toms_msge where rownum<2; LENGTH(CNTNT) DBMS_LOB.GETLENGTH(CNTNT) ------------- ------------------------- 3837 3837
Published by: PhoenixBai on September 24, 2009 13:40
-
Hi all
Here is the structure of the table with two expression of virtual columns associated highlighted, now I want to delete these expressions with virtual columns (but must keep my VIRTUAL columns as it is).
Is it possible the alter or I need to raise the table, make a new structure and copy content back to newly structured table... Pleae help!
CREATE TABLE TEST_COL)
SAGE_TRADE_TYPE VARCHAR2 (50 BYTE),
LOCAL_TZ VARCHAR2 (20 BYTE),
ACE GMT_CONV_ENTERED_DT_TS (SAGEDBO. FN_CONVERT_TIMEZONE (LOCAL_TZ, ENTERED_DT_TS)) VIRTUAL,.
ACE GMT_CONV_EXECUTION_DT_TS (SAGEDBO. FN_CONVERT_TIMEZONE (LOCAL_TZ, UPSTREAM_EXECUTION_TS)) VIRTUAL,.
EOD_IND VARCHAR2 (10 BYTE)
);
Thank you very much
Arpit
Try this
ALTER table test_col change gmt_conv_entered_dt_ts (0) virtual;
ALTER table test_col change gmt_conv_execution_dt_ts (1) virtual;
-
Creating table in the model with 80 columns
Hello
I am trying to create a model to display 80 columns, but in Word format, I get the message "you cannot create a table with more than 63 columns.
Can how I put the 80 columns in the Template.rtf?
Env: Suite Oracle E business 12
Output required: Excel
Thanks in advance.It's the MSword limitation and no BEEP, but indirectly there is a limitation of the BEEP ;)
MSWord supports only maximum of 63 columns.
As MS Word supports only the width of page maximum of 22 inches wide and 22 inches high.Option 1:
Create a table with two columns
Insert a table with 63 columns in the first cell,
Insert a table with 63 columns in the second cell,
How we can get rid of limitations columns.Option 2:
If you want to use more than 63, then you use templates other than RTF. I recommend XSL.
-
Update a table with one column of another
Oracle 11g
Helloi'im trying to update the two columns of table SUPPORT (SUPPORT_X, SUPPORT_Y) with two columns of table POST_HTA_BT (POSTHTABT_GPS_X, POSTHTABT_GPS_Y)
Understand that the two tables have the colum below:
SUPPORT (SUPPORT_ID, SUPPORT_PLAQUE, POSTHTABT_ID, SUPPORT_X, SUPPORT_Y,...)
POST_HTA_BT (POSTHTABT_ID, POSTHTABT_GPS_X, POSTHTABT_GPS_Y,...)
The SUPPORT_PLAQUE has type varachar. Except the keys, the other columns are varchar type in both tables.
The point here is to update the support_x, support_y with posthtabt_gps_x and posthtabt_gps_y.But before the update we have Sheik if the fifth number of the support plate is a number of characters from "0" to "9"and the rest of the caracter of the support_plaque is '00000'
Please note that the support_plaque is stored in the table with the form: "0025800000!"
So I did the below script, I try to execute in sql develop.
SET SERVEROUTPUT ON
DECLARE
chiffre_liste varchar (200): = '0 ', '1', '2', '3', '4', ' 5 ', ' 6' ', 7', ' 8 ', ' 9';
CURSOR CUR_GPS_SUPPORT IS
Select MEDIA. SUPPORT_X, SUPPORT. SUPPORT_Y, POSTE_HTA_BT. POSTHTABT_ID, SUPPORT. EXPL_ID,
SUPPORTED. SUPPORT_PLAQUE, POSTHTABT_GPS_X, POSTHTABT_GPS_Y
support,.
POSTE_HTA_BT
where
SUPPORTED. SUPPORT_X IS NULL and
SUPPORTED. SUPPORT_Y IS NULL and
SUPPORTED. POSTHTABT_ID = POSTE_HTA_BT. POSTHTABT_ID and
SUPPORTED. EXPL_ID = POSTE_HTA_BT. EXPL_ID
Order of SUPPORT. POSTHTABT_ID;w_POSTHTABT_ID POSTE_HTA_BT. Type of POSTHTABT_ID %;
w_SUPPORT_X SUPPORT. TYPE % SUPPORT_X;
w_SUPPORT_Y SUPPORT. TYPE % SUPPORT_Y;
w_EXPL_ID SUPPORT. TYPE % EXPL_ID;
w_SUPPORT_PLAQUE SUPPORT. TYPE % SUPPORT_PLAQUE;
w_POSTHTABT_GPS_X POSTE_HTA_BT. TYPE % POSTHTABT_GPS_X;
w_POSTHTABT_GPS_Y POSTE_HTA_BT. TYPE % POSTHTABT_GPS_Y;BEGIN
DBMS_OUTPUT. Put_line ('loading the coordoonnees GPS - GPS Coord update takes care of starting ');FOR HEART LOOPING CUR_GPS_SUPPORT
w_POSTHTABT_ID: = cur. POSTHTABT_ID;
w_SUPPORT_PLAQUE: = cur. SUPPORT_PLAQUE;
w_SUPPORT_X: = cur. SUPPORT_X;
w_SUPPORT_Y: = cur. SUPPORT_Y;
w_POSTHTABT_GPS_X: = cur. POSTHTABT_GPS_X;
w_POSTHTABT_GPS_Y: = cur. POSTHTABT_GPS_X;If substr (cur.support_plaque, 5, 1 chiffre_liste) and substr (cur.support_plaque, 6, 5) = '00000'
w_SUPPORT_X: = CUR. POSTHTABT_GPS_X
w_SUPPORT_Y: = CUR. POSTHTABT_GPS_Y
END if;
EXCEPTION WHEN NO_DATA_FOUND THEN w_SUPPORT_X: = NULL and w_SUPPORT_Y: = NULL;
END;-Updated the table of the supports
Update SUPPORT
Set SUPPORT_X = w_SUPPORT_X,
SUPPORT_Y = w_SUPPORT_Y
where SUPPORT_PLAQUE = w_SUPPORT_PLAQUE;
-On valid imm? immediately
commit;
EXCEPTION when no_data_found then null;
-No details found
END;
END;
/and I got the following errors:
Error report:
ORA-06550: line 2, colum 34:
PLS-00103: symbol ',' met instead of one of the following symbols:* & = - + ; <>/ is mod remains not rem
<>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
like4 likec between | submultiset of type multiset Member
ORA-06550: line 2, column 52:
PLS-00103: symbol ';' met instead of one of the following symbols:), * & = - + <>/ is mod remains not rem = >
<>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
like4 likec between | Member of multiset must
ORA-06550: line 38, colum 48:
PLS-00103: symbol 'CHIFFRE_LISTE' met instead of one of the following symbols:(
Symbol "(" a été substitué à "CHIFFRE_LISTE" verser continuer.) "
ORA-06550: line 39, 12 colum:
PLS-00103: symbol 'W_SUPPORT_X' met instead of one of the following symbols:), * & -+ / at rem mod < Hurst (*) > rest and or.
multiset
ORA-06550: line 40, 12 colum:
PLS-00103: symbol 'W_SUPPORT_Y' met instead of one of the following symbols:. (), * @ % & = - + <>/ is mod remains not rem
<>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
like4 likec between | mult
ORA-06550: line 41, colum 9:
PLS-00103: symbol 'END' met instead of one of the following symbols:. (), * @ % & = - + <>/ is mod remains not rem
<>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
like4 likec between | multiset members
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:I checked the line number, but do not see the error in my code.
Please could you help me?
peace
Hello
glad to know that it worked. In fact, I don't see the reason to make these complicated processes.
Remember the mantra:
- If you can do it with SQL then do it with SQL
Good evening!
Alberto
-
Declare a type of table with multiple columns
I have a table with a column of type, and I want to create one with two columns.
My type is:
create or replace type "NUMBER_TABLE" in the table of the number;
And I use it in function:
FUNCTION GetValues()
return NUMBER_TABLE
as
results NUMBER_TABLE: = NUMBER_TABLE();
Start
Select OrderId bulk collect in: results from (select * from tbl_orders);
-Other code...
end;
I want select it be like this:
Select OrderId, OrderAddress bulk collect into: results from (select * from tbl_orders);
How to do this?Is that what you are looking for:
CREATE OR REPLACE TYPE two_col_rec AS OBJECT (empno NUMBER, ename VARCHAR2(10)) / CREATE OR REPLACE TYPE two_col_table AS TABLE OF two_col; / CREATE OR REPLACE FUNCTION GetValues RETURN two_col_table AS results two_col_table := two_col_table(); BEGIN SELECT two_col(empno, ename) BULK COLLECT INTO results FROM emp; -- RETURN results; END; / show errors
-
Need to create a new line in the table with the same data as the primary key, but new PK
Hello gurus,
I have a table with a column as a primary key, I need to create a new row in the table, but with the same data in one of the lines, but with different primary keys, focus a double row with key primary diferent...
Any ideas of how it can be done without much complication?
Thanks in advance for your answer.
Agress,
Karim idrissiuser9970447 wrote:
Hello gurus,I have a table with a column as a primary key, I need to create a new row in the table, but with the same data in one of the lines, but with different primary keys, focus a double row with key primary diferent...
Any ideas of how it can be done without much complication?
Thanks in advance for your answer.
Agress,
Karim idrissisomething like
insert into mytable values ('literal for new pk', select non-pk-1, non-pk-2, non-pk-n from mytable where pk-col = 'literal for existing pk')
-
Insert into the table with the help of the string
Hi all
I have a string with commas.
Is it possible to insert the values of string directly in the table in each column.
For ex:
v_str = "10,20,30,40";
insert into v_tab (col1, col2, col3, col4) values (10,20,30,40);
I would like to pass v_str instead of numbers in the insert statement.
Thank you
I try with this simple block
How can achieve us ifDECLARE v_char VARCHAR2(1000) := '10,20'; v_query VARCHAR2(3000); BEGIN v_query := 'INSERT INTO week_bkgs(week_num, product_bkg) VALUES (:x)'; EXECUTE IMMEDIATE v_query USING v_char; END; /
the column a. data types are the NUMBER
b column data types are VARCHAR2
Published by: polasa on October 30, 2008 21:20Try this
SQL> set lines 100 SQL> desc student; Name Null? Type ----------------------------------------------------- -------- ------------------------------------ NAME VARCHAR2(100) STUDENT_NUMBER NUMBER(10) SQL> declare 2 str_v varchar2(100) :='''abc'',1'; 3 begin 4 execute immediate 'insert into student values ('|| str_v ||')'; 5 end; 6 / PL/SQL procedure successfully completed. SQL> select * from student where student_number=1 2 ; NAME STUDENT_NUMBER -------------------- -------------- abc 1 SQL>
-
Possible bug: save the table with double and extended precision to the worksheet
If one concatenates an array of double-precision and an array of precision extended with the 'build' vi table, then recorded using 'Write in a spreadsheet file' vi any digits to the right of the decimal are reset to zero in the saved file. Regardless of the entry of signifier of format (for example %.10f) to the vi 'Write in a spreadsheet file'.
I'm on Vista Ultimate 32 bit and labview 9.0
This is a possible bug that is easily circumvented by the conversion of a type before you incorporate arrar in a worksheet. Nevertheless, it's a bug and it cost me some time.
Hi JL,.
No, this is not a bug - it's a feature
Well, if you'd look closer you would recognize the 'save to spreadsheet' as polymorphic VI. As this polymorphic VI does not support the EXTENSION numbers internally (it only supports DBL, I64, and String) LabVIEW selects the instance with more precision: I64 (I64 a 64 bits of precision, DBL that 53...). Your options are:
-the value of the instance to use as the DBL (by right click and "Select type... »)
-make a copy of this VI, save it under a different name and make support number of POST (not rework the polymorphic VI like you would break compatibility with other facilities of LV or future revisions)
-
Gears - error when you try to insert values into a table with multiple columns
Hello
I started playing with the gears and SQlLite today and I get an error when I try to insert values into a table with multiple columns.
I have:
var db = google.gears.factory.create('beta.database'); db.open('developerSet'); db.execute('create table if not exists Developers (DeveloperName text, DeveloperAge int)'); var devName = "Davy" var devAge = 32; try { db.execute('insert into Developers values (?, ?)', [devName, devAge]); alert('success'); } catch (e) { alert(e); }
I get the error:
net.rim.device.api.database.DatabaseException; insert into developers values (?,?): SQL logic error or missing database.
I use this reference: http://code.google.com/apis/gears/api_database.html
Everything works if I have only one field as:
var db = google.gears.factory.create('beta.database'); db.open('developerSet'); db.execute('create table if not exists Developers (DeveloperName text)'); var devName = "Davy" var devAge = 32; try { db.execute('insert into Developers values (?)', [devName]); alert('success'); } catch (e) { alert(e); }
I use the plug-in Visual Studio 2.0 for 2008 that are running Windows XP SP and Simulator 2.13.0.56
Thank you
Davy
Yes, a SQLite database will persist between battery pulls. The database is registered either to internal MEM or removable media (not the device memory), depending on which is available on your device.
In general, its not considered a best practice to remove your table as soon as it is empty and re - create it again when you want to add data. This adds extra overhead fresh for the final, delete and insert first for a given table. Instead, define and finalize your drawing before you create your table. Once created, review the static schema.
That being said, for development purposes, it may be easier to provide an easy way to drop your tables while you develop your schema.
See you soon,.
Adam
-
Export an ADF table with default column order
Hello
Jdev 11.1.1.5.0
We have ADF Table with column drag and drop option. Also we have implemented ADF Table with excelHTMl type of export.
Everything works as expected. Only problem is if we try to exchange a few columns by drag-and - drop option and then export the table, we receive the order of the columns with brewing. But our demand is, the user must obtain the export with the initial order table by default.
It would be great, if you can suggest an idea to export the ADF table with default column order.
Thanks in advance,
MSR.
I realized the required functionality. We can restore the default order of the columns to aid
Function richeTableau = this.getFetchResultsTable (); Iterator rItr = rTable.getChildren () .iterator (); {while (rItr.hasNext ())} ((RichColumn) rItr.next ()).setDisplayIndex(-1); } Then we can call the real export help feature
queue the event via a JavaScript inserted into the page FacesContext context = FacesContext.getCurrentInstance (); Erks = ExtendedRenderKitService Service.getService (context.getRenderKit (), ExtendedRenderKitService.class); erks.addScript (context, "customHandler()"); -
Mr President.
Can fill us transitional attribute in the table with no serial like 1,2,3, etc.? And how?
Concerning
You want to show serial No. on the page for all the lines?
Check once-
Actually transitional attribute loses its value when page refreshes or viewObject is not appropriate in this case if your use case is different, so please tell us
Ashish
-
I have the table of 3 columns A, B, C. I want to store the sum of columns A B in the C column without using the DML statements. Can anyone help please how to do. ?
11.1 and especially you have virtual column
SQL> create table t 2 ( 3 a number 4 , b number 5 , c generated always as (a+b) virtual 6 ); Table created. SQL> insert into t (a, b) values (1, 2); 1 row created. SQL> select * from t; A B C ---------- ---------- ---------- 1 2 3
Before that, a front insert - trigger
SQL> create table t 2 ( 3 a number 4 , b number 5 , c number 6 ); Table created. SQL> create or replace trigger t_default before insert on t for each row 2 begin 3 :new.c := :new.a+:new.b; 4 end; 5 / Trigger created. SQL> insert into t (a, b) values (1, 2); 1 row created. SQL> select * from t; A B C ---------- ---------- ---------- 1 2 3
-
Select the line with the smallest Beach
Hello
I am trying to build a complex query...
He must select the line with the inner range...
I'll explain for example:
Location of poolsize ID value
1 32 8
2 40 6
3 42 8
4-36-3
I want to select the line where the fork between value and value + poolsize is shared also with the other location...
so:
1 is 32-40 (in A place)
2 is 40-46 (in place)
3 is 42-48 (location B)
4 is 36-39 (at location B)
4 is located at 1 (and there are different places...) so sql must return to the fourth line.
Any help will be appreciated!
Thank you
fcbmanHello
fcbman1899 wrote:
Hello
I am trying to build a complex query...
He must select the line with the inner range...I'll explain for example:
Location of poolsize ID value
1 32 8
2 40 6
3 42 8
4-36-3Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data, in order to let the people who want to help you re-Ridge the problem and test their ideas.
See the FAQ forum {message identifier: = 9360002}I want to select the line where the fork between value and value + poolsize is shared also with the other location...
so:
1 is 32-40 (in A place)
2 is 40-46 (in place)
3 is 42-48 (location B)
4 is 36-39 (at location B)4 is located at 1 (and there are different places...) so sql must return to the fourth line.
To find all the rows that are within the range of at least one other line with another location:
SELECT * FROM table_x m WHERE EXISTS ( SELECT 1 FROM table_x WHERE location != m.location AND value <= m.value AND value + poolsize >= m.value + m.poolsize ) ;
When you talk of the "" * most * inner range ", do you mean that you might have another line, such as"
INSERT INTO table_x (id, vlue, poolsize, location) VALUES (5, 37, 1, 'C');
which is inside the range of id - 4, and that's why you wouldn't have id = 4? If so, include examples in the results and data sample yout. You can do this with a query CONNECT BY, or, depending on your version of Oracle, a WITH recursive clause.
Maybe you are looking for
-
Beach ball of rotation on Mac Mini (mid 2011)
My Mac Mini (mid 2011). When I try to install everything I get is a beach of rotation ball.
-
Problems with Yahoo Mail new fonts
New Yahoo Mail written police community is too small and the larger font is too fat also before writing is smaller than the police to know, what is the problem?
-
Is it possible to backup my emails on my external hard drive?
I am Secretary of the Association of my owner and need to archive the emails related to this. I would like to be able to keep them on my external hard drive, if possible. I know I could do with Outlook Express but who have not used for quite awhile n
-
How to activate the new version of Firefox?
Well I downloaded new versions of Firefox when you are prompted and today have downloaded version 8.0.1exe it seems that it is not active and I'm still on version 3.6.
-
How to make a copy of the address iPhone 6s list automatically fill?
Recently, I left my previous company after working there for 15 years. I was able to transfer ownership of my work mobile phone number to become my personal phone number, even if I had to buy a new iphone. I was also able to transfer my contact lis