Help with Nested Table
Hello All
I have a task about insert data into a nested table. First I will explain the scenario.
I have 2 table (patients) and (tumors) that contain medical data about cancer patients.
CREATE TABLE "DSS2_MINING"."PATIENTS"
( "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE,
"REGISTRY_ID" NUMBER(10,0),
"RACE" VARCHAR2(2 BYTE),
"SEX" VARCHAR2(1 BYTE),
"BIRTHDATE_YEAR" NUMBER(4,0),
"NUMBER_OF_PRIMARIES" NUMBER(1,0),
"VITAL_STATUS_RECORD" VARCHAR2(1 BYTE),
"CAUSE_OF_DEATH" VARCHAR2(5 BYTE),
"SURVIVAL_TIME" VARCHAR2(4 BYTE),
"SURVIVAL_TIME_FINAL" NUMBER,
"SURVIVAL_VARIABLE" VARCHAR2(1 BYTE),
CONSTRAINT "PATIENTS_PK" PRIMARY KEY ("PATIENT_ID");
CREATE TABLE "DSS2_MINING"."TUMORS"
( "TUMOR_ID" NUMBER NOT NULL ENABLE,
"PATIENT_ID" VARCHAR2(10 BYTE), -- FK
"SEER_RECORD_NUMBER" NUMBER, -- This column contain a sequance number of the records for each patients
"MARITAL_STATUS" VARCHAR2(1 BYTE),
"AGE" NUMBER,
"DATE_OF_DIAGNOSIS" DATE,
"HISTOLOGY_GROUP" VARCHAR2(2 BYTE),
"BEHAVIOR" VARCHAR2(1 BYTE),
"GRADE" VARCHAR2(1 BYTE),
"DERIVED_AJCC_STAGE_GROUP" VARCHAR2(2 BYTE),
"STAGE_OF_CANCER" VARCHAR2(2 BYTE),
"RADIATION" VARCHAR2(1 BYTE),
"CS_SCHEMA" VARCHAR2(2 BYTE),
"FIRST_PRIMARY_IND" VARCHAR2(1 BYTE),
"TUMOR_SIZE" NUMBER(4,1),
"TUMOR_EXTENSION" VARCHAR2(2 BYTE),
"LYMPH_NODES" VARCHAR2(1 BYTE),
"NODES_POSITIVE" NUMBER,
"ESTROGEN" VARCHAR2(3 BYTE),
"PROGESTERONE" VARCHAR2(3 BYTE),
"SURGERY" VARCHAR2(2 BYTE),
CONSTRAINT "TUMORS_PK" PRIMARY KEY ("TUMOR_ID");The table (patients) contain the basic information about the patients. The table (tumors) contain information about the tumors. each record in the (patients) table can have one or more records in the (tumors) table using the (patient_id) column. I wanna move the data from the (patients) and (tumors) tables to a new table (cancer_patients) that contain a nested table column. so I did the following code
create or replace type tumor_object AS
object(
tumor_id VARCHAR2(1),
marital_status VARCHAR2(1),
age NUMBER(3),
date_of_diagnosis DATE,
cs_schema VARCHAR2(2),
histology_group VARCHAR2(2),
behavior VARCHAR2(1),
grade VARCHAR2(1),
first_primary_ind VARCHAR2(1),
tumor_size NUMBER(4, 1),
tumor_extension VARCHAR2(2),
lymph_nodes VARCHAR2(1),
nodes_positive NUMBER(4),
surgery VARCHAR2(2),
radiation VARCHAR2(1)
create or replace type tumor_table as table of tumor_object;
CREATE TABLE "DSS2_MINING"."CANCER_PATIENTS"
( "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE,
"RACE" VARCHAR2(2 BYTE),
"SEX" VARCHAR2(1 BYTE),
"NUMBER_OF_PRIMARIES" NUMBER(1,0),
"TUMORS" "DSS2_MINING"."TUMOR_TABLE" ,
"VITAL_STATUS_RECORD" VARCHAR2(1 BYTE),
"CAUSE_OF_DEATH" VARCHAR2(5 BYTE),
"SURVIVAL_TIME_FINAL" NUMBER,
"SURVIVAL_VARIABLE" VARCHAR2(1 BYTE),
CONSTRAINT "CANCER_PATIENTS_PK" PRIMARY KEY ("PATIENT_ID")
NESTED TABLE "TUMORS" STORE AS "TUMORS_STOR_TABLE"
So my problem about how to transfer and insert the data, I tried to use the associative array to hold the rows of the tumors table but it didn't work out. I think the main issue is that each record in the patients table have multiple records in the tumors table.
I hope if anybody can help in this case or I you know any reference about similar cases
Thanks
A.L
Edited by: user9003901 on Nov 26, 2010 2:48 AM
Something like:
INSERT
INTO CANCER_PATIENTS
SELECT PATIENT_ID,
RACE,
SEX,
NUMBER_OF_PRIMARIES,
SELECT CAST(
COLLECT(
TUMOR_OBJECT(
TUMOR_ID,
MARITAL_STATUS,
AGE,
DATE_OF_DIAGNOSIS,
CS_SCHEMA,
HISTOLOGY_GROUP,
BEHAVIOR,
GRADE,
FIRST_PRIMARY_IND,
TUMOR_SIZE,
TUMOR_EXTENSION,
LYMPH_NODES,
NODES_POSITIVE,
SURGERY ,
RADIATION
AS TUMOR_TABLE
FROM "TUMORS" T
WHERE T.PATIENT_ID = P.PATIENT_ID
VITAL_STATUS_RECORD,
CAUSE_OF_DEATH,
SURVIVAL_TIME_FINAL,
SURVIVAL_VARIABLE
FROM PATIENTS P
/SY.
P.S. This site has censorship. It replaces word S E X with ***, so change it back when testing.
Similar Messages
-
Hi,
I am using the following code which is failing with no data found error.
While if i hardcode the same value the code works.
create table test(input varchar2(10),result varchar2(10));
insert into test values('4093163','SUCCESS')
declare
TYPE acctid_tab IS table OF varchar2(40);
acctid acctid_tab := acctid_tab ();
V_RESULT varchar2(20);
v_input varchar2(40);
i pls_integer;
begin
acctid := acctid_tab('4080402 4093163 64472');
i := acctid.FIRST;
WHILE i IS NOT NULL
LOOP
v_input := trim(substr(acctid(i),instr(acctid(i),' ',1),instr(acctid(i),' ',-1,2)));
SElect result into v_result from test
where input = v_input;
i := acctid.NEXT (i);
END LOOP;
END;
ORA-01403: no data found
ORA-06512: at line 14
declare
TYPE acctid_tab IS table OF varchar2(40);
acctid acctid_tab := acctid_tab ();
V_RESULT varchar2(20);
v_input varchar2(40);
i pls_integer;
begin
acctid := acctid_tab('4080402 4093163 64472');
i := acctid.FIRST;
WHILE i IS NOT NULL
LOOP
v_input := trim(substr(acctid(i),instr(acctid(i),' ',1),instr(acctid(i),' ',-1,2)));
SElect result into v_result from test
where input = '4093163';
i := acctid.NEXT (i);
END LOOP;
END;
PL/SQL procedure successfully completed.Please advise.
Thanks in advance.I guess you can just do
declare
v_input varchar2(1000);
begin
v_input := '4080402 4093163 64472';
for i in (select input, result
from test
where input in (select regexp_substr(v_input, '[^ ]*', 1, level)
from dual
connect by level <= length(v_input) - length(replace(v_input, ' ')) + 1))
loop
dbms_output.put_line(i.input || ' ' || i.result);
end loop;
end;
/Or even better
declare
v_input varchar2(1000);
begin
v_input := '4080402 4093163 64472';
for i in (select input, result
from test
where ' ' || v_input || ' ' like '% ' || input || ' %')
loop
dbms_output.put_line(i.input || ' ' || i.result);
end loop;
end; -
Hi all,
My proc gives an error 'PLS-00801: internal error [20605]' at line 5 of the proc ...
Create or replace procedure P_cleanse as
type ty_num is table of number;
PID ty_num;
BEGIN
PID():=('907084','807081','807082','807083','907082','907083','907081');
for t in PID.first .. PID.last
loop
delete from stg_participant where rowid in
(select min(rowid) from stg_participant group by participant_id having participant_id=pid(t));
DBMS_OUTPUT.PUT_LINE('Total delete = '||sql%rowcount);
commit;
update stg_participant
set status='FROM_SUGAR'
where participant_id=pid(t);
DBMS_OUTPUT.PUT_LINE('Total update = '||sql%rowcount);
commit;
END LOOP;
END;
any clue ?
Thanks in advance !
nullfigured it out ...
Create or replace procedure P_cleanse as
type ty_num is table of number;
PID ty_num;
BEGIN
PID:= ty_num('907084','807081','807082','807083','907082','907083','907081');
for t in PID.first .. PID.last
loop
delete from stg_participant where rowid in
(select min(rowid) from stg_participant group by participant_id having participant_id=pid(t));
DBMS_OUTPUT.PUT_LINE('Total delete = '||sql%rowcount);
commit;
update stg_participant
set status='FROM_SUGAR'
where participant_id=pid(t);
DBMS_OUTPUT.PUT_LINE('Total update = '||sql%rowcount);
commit;
END LOOP;
END;
thz ! -
Partition exchange error on table with nested table
On Oracle 11.2.0.1, I have a partitioned table with some partitions that need to be 'archived' (in terms of moving partitions to an 'archive' table).
I have a source table like:
CREATE TABLE IS_PODACI245
ID_OBJEKTA_IDENTIFIKACIJA NUMBER(10),
ID_OBJEKTA NUMBER(20),
DATUM TIMESTAMP(6) NOT NULL,
TZ NUMBER(3),
DATA1 NUMBER(10),
DATA2 NUMBER(6),
DATA3 NUMBER(10),
DATA4 NUMBER,
DATA5 T_NTCIP_CLIMATE_TABLE
NESTED TABLE DATA5 STORE AS IS_PODACI245_STORE_TABLE
TABLESPACE DATA
PARTITION BY RANGE (DATUM)
PARTITION P_201107 VALUES LESS THAN (TIMESTAMP' 2011-08-01 00:00:00')
LOGGING
NOCOMPRESS
TABLESPACE DATA,
PARTITION P_MAXVALUE VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE DATA
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
CREATE INDEX IDX_IS_PODACI245_KOMPLEKS ON IS_PODACI245
(ID_OBJEKTA_IDENTIFIKACIJA, ID_OBJEKTA, DATUM)
TABLESPACE DATA
LOCAL (
PARTITION P_201107
LOGGING
NOCOMPRESS
TABLESPACE DATA,
PARTITION P_MAXVALUE
LOGGING
NOCOMPRESS
TABLESPACE DATA
NOPARALLEL;
CREATE OR REPLACE TYPE t_ntcip_climate_table as table of t_ntcip_climate_fmt;
CREATE OR REPLACE TYPE t_ntcip_climate_FMT as object
( dev_index number(6)
, dev_description varchar2(512)
, dev_type number(10)
, dev_status number(10)
, dev_mfr_status varchar2(512)
, dev_active number(3)
, dev_test_activation number(10)
/I would like to make exchange partition using stage table, and everything is going fine on all tables, but only on a few of them (listed source is one of them, and they're only tables with nested tables wihin), where I get an error.. but sometimes ;)
on a statement like:
ALTER TABLE IS_PODACI245_ARH EXCHANGE PARTITION P_201106 WITH TABLE IS_PODACI245_STAGE EXCLUDING INDEXES WITHOUT VALIDATION;I got an error:
ORA-00001: unique constraint (TXV.SYS_C0032911) violated
it's an unique index between parent and nested table.
what could cause that problem?Dear,
I suppose that the unique constraint
ORA-00001: unique constraint (TXV.SYS_C0032911) violatedis the one you 've created on the nested table IS_PODACI245_STORE_TABLE
If so, why not disable that constraint and try again.
I have never exchanged such a kind of partitioned table having a nested table in it. But, I could imagine that the cloned non partitioned table IS_PODACI245_STAGE should at least be the exact image of the partitioned table IS_PODACI245_ARH (of course without the partition part) but with the nested table part and including all indexes
In addition, if you have a parent/child relationship between your partitioned tables, then there is a chronological order of exchange starting by the child and then finishing by the parent
see the following link for more information about this order of exchange (and comment 2 for an example also)
http://jonathanlewis.wordpress.com/2006/12/10/drop-parent-partition/#more-65
Hope this helps
Mohamed Houri -
Problem when expanding Tree - Tree with nested table column
Hi, i have created the tree using the Tree with nested table column.
I have created a node called TREE_ROOT in the context.
This node has few attributes which includes children_loaded, is_leaf, is_expanded.
I have created the recursive node TREE_SUB for the above node TREE_ROOT.
In the view, i have created the table with the master column. The above attributes have been mapped accordingly. I have created the action handler for load_children.
In this action handler method, i receive the context_element correctly. In this method, i determine the children of the selected element and the resulting children are attached to this context_element.
But the problem is: when i add elements to context_elements in the method load_children, these
elements get added to the node TREE_ROOT as well.
Please help.
thanks and best regards,
PramodI just use some types defined in this user... Well, I hope you know what is the type definition of d_period_sec,
don't you ? I didn't ask to provide all types existed now, only types you are
using.
Anyhow you have been granted with execute privilege for types you are using:
SQL> conn tau_tll/tau_tll;
Connected.
SQL> create or replace type d_period_sec as object (date# date);
2 /
Type created.
SQL> grant execute on d_period_sec to public with grant option;
Grant succeeded.
SQL> conn scott/tiger
Connected.
SQL> CREATE OR REPLACE TYPE unit_function AS OBJECT (
2 xi NUMBER,
3 yi NUMBER,
4 xe NUMBER,
5 ye NUMBER,
6 xm NUMBER,
7 ym NUMBER,
8 v NUMBER,
9 a NUMBER,
10 f NUMBER,
11 descr VARCHAR2 (20)
12 );
13 /
Type created.
SQL> grant execute on unit_function to master;
Grant succeeded.
SQL> CREATE OR REPLACE TYPE unit_moving_point AS OBJECT
2 (
3 p tau_tll.d_period_sec, -- from user TAU_TLL
4
5 m unit_function
6 )
7 /
Type created.
SQL> grant execute on unit_moving_point to master;
Grant succeeded.
SQL> CREATE OR REPLACE TYPE moving_point_tab AS TABLE OF unit_moving_point;
2 /
Type created.
SQL> grant execute on moving_point_tab to master;
Grant succeeded.
SQL> CREATE OR REPLACE TYPE moving_point AS OBJECT (u_tab moving_point_tab);
2 /
Type created.
SQL> grant execute on moving_point to master;
Grant succeeded.
SQL> conn master/master
Connected.
SQL> CREATE TABLE MPOINTS (
2 id NUMBER,
3 mpoint scott.Moving_Point)
4 NESTED TABLE mpoint.u_tab store as moving_tab;
Table created.Rgds. -
ANSI Standard Join with Nested Table
Does anyone know how to (or whether you actually can) use ansi standard table joins with nested tables.
Non-ansi standard would look something like this
SELECT e.empno
FROM departments d, TABLE(d.employees) e
WHERE d.deptno = 10;
Where d.employees is a nested table.
But if I try ansi-standard I like such:
SELECT e.empno
FROM departments d
JOIN TABLE(d.employees) e
WHERE d.deptno = 10;
I get
ORA-00905: missing keyword
because I have nothing to join it on.
Your help is very much appreciatedBoth replies worked fine.
I think I will go with the NATURAL JOIN as it seems the cleanest option.
Thanks Guru 2748 -
Fill datagridview with Nested Table Object Type ???
Hello everybody, please you help me resolve my problem?
I follow this example: *(A Sample Application using Object-Relational features)* http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10799/adobjxmp.htm
And this tutorial: *(Using Oracle User-Defined Types with .NET and Visual Studio)* http://www.oracle.com/technology/obe/hol08/dotnet/udt/udt_otn.htm
Now I have 3 Object Table: Stock, Customer and Purchase Order. With the tutorial it's OK to show the data of Stock and Customer Table [there is no nested table in], but I can't do this with table Purchase Order, the tutorial don't show how to work with Nested Table type [Missing or something ?]
When I try to display the data of table Purchase Order, I get the error:
typeName='LINEITEMLIST_NTABTYP'' is not specified or is invalid*
Follow the tutorial, I generate custom class for this UDT and get another error:
this.STOCK_REF = ((object)(Oracle.DataAccess.Types.OracleUdt.GetValue(con, pUdt, "STOCK_REF")));*
Argument Exception Unhandle: Object attribute is not mapped to a custom type member.*
Can You show me how to do this ? Show the data of the Nested Table in Visual Studio, do I have something wrong ??? Thanks and Best Regards.I think you need to go through the tutorial more carefully. I think you are missing steps.
You are using a REF. Are you creating an object table for the objects to be stored in? Are you dereferencing the REF? This is covered by the Oracle by Example tutorial.
http://www.oracle.com/technology/obe/hol08/dotnet/udt/udt_otn.htm#t11
When you receive the nested table, it will be inside a .NET class. You can create this class by using the Create Custom Class menu item on the nested table type in server explorer.
This class will contain a ToString method and a ToXML method.
The question is, where are you attempting to display the data from this nested table? In a grid?
Does it make sense to display a nested table inside one cell of a grid? No. You would need to construct a special UI that will show the
nested table. Maybe the user clicks on the cell on the grid, which opens a new grid that displays the data. Or maybe there is a second grid on the form that always shows the nested table for the row that the first grid currently has selected.
I realize I am not providing you the code... but it sounds like you need to design a more sohisticated UI than what the tutorial is using -- one that can handle displaying one additional table per row. -
Please I need some help with a table
Hi All
I need some help with a table.
My table needs to hold prices that the user can update.
Also has a total of the column.
my question is if the user adds in a new price how can i pick up the value they have just entered and then add it to the total which will be the last row in the table?
I have a loop that gets all the values of the column, so I can get the total but it is when the user adds in a new value that I need some help with.
I have tried using but as I need to set the toal with something like total
totalTable.setValueAt(total, totalTable.getRowCount()-1,1); I end up with an infinite loop.
Can any one please advise on some way I can get this to work ?
Thanks for reading
CraigHi there camickr
thanks for the help the other day
this is my full code....
package printing;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import javax.swing.*;
import javax.swing.table.*;
import java.text.DecimalFormat;
public class tablePanel
extends JDialog implements Printable {
BorderLayout borderLayout1 = new BorderLayout();
private boolean printing = false;
private Dialog1 dialog;
JPanel jPanel = new JPanel();
JTable table;
JScrollPane scrollPane1 = new JScrollPane();
DefaultTableModel model;
private String[] columnNames = {
private Object[][] data;
private String selectTotal;
private double total;
public tablePanel(Dialog1 dp) {
dp = dialog;
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
public tablePanel() {
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
private void jbInit() throws Exception {
jPanel.setLayout(borderLayout1);
scrollPane1.setBounds(new Rectangle(260, 168, 0, 0));
this.add(jPanel);
jPanel.add(scrollPane1, java.awt.BorderLayout.CENTER);
scrollPane1.getViewport().add(table);
jPanel.setOpaque(true);
newTable();
addToModel();
addRows();
setTotal();
public static void main(String[] args) {
tablePanel tablePanel = new tablePanel();
tablePanel.pack();
tablePanel.setVisible(true);
public void setTotal() {
total = 0;
int i = table.getRowCount();
for (i = 0; i < table.getRowCount(); i++) {
String name = (String) table.getValueAt(i, 1);
if (!"".equals(name)) {
if (i != table.getRowCount() - 1) {
double dt = Double.parseDouble(name);
total = total + dt;
String str = Double.toString(total);
table.setValueAt(str, table.getRowCount() - 1, 1);
super.repaint();
public void newTable() {
model = new DefaultTableModel(data, columnNames) {
table = new JTable() {
public Component prepareRenderer(TableCellRenderer renderer,
int row, int col) {
Component c = super.prepareRenderer(renderer, row, col);
if (printing) {
c.setBackground(getBackground());
else {
if (row % 2 == 1 && !isCellSelected(row, col)) {
c.setBackground(getBackground());
else {
c.setBackground(new Color(227, 239, 250));
if (isCellSelected(row, col)) {
c.setBackground(new Color(190, 220, 250));
return c;
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (e.getClickCount() == 1) {
if (table.getSelectedColumn() == 1) {
table.setTableHeader(null);
table.setModel(model);
scrollPane1.getViewport().add(table);
table.getColumnModel().getColumn(1).setCellRenderer(new TableRenderDollar());
public void addToModel() {
Object[] data = {
"Price", "5800"};
model.addRow(data);
public void addRows() {
int rows = 20;
for (int i = 0; i < rows; i++) {
Object[] data = {
model.addRow(data);
public void printOut() {
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(tablePanel.this);
pj.printDialog();
try {
pj.print();
catch (Exception PrintException) {}
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
int fontHeight = g2.getFontMetrics().getHeight();
int fontDesent = g2.getFontMetrics().getDescent();
//leave room for page number
double pageHeight = pageFormat.getImageableHeight() - fontHeight;
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) table.getColumnModel().getTotalColumnWidth();
double scale = 1;
if (tableWidth >= pageWidth) {
scale = pageWidth / tableWidth;
double headerHeightOnPage = 16.0;
//double headerHeightOnPage = table.getTableHeader().getHeight() * scale;
//System.out.println("this is the hedder heigth " + headerHeightOnPage);
double tableWidthOnPage = tableWidth * scale;
double oneRowHeight = (table.getRowHeight() + table.getRowMargin()) * scale;
int numRowsOnAPage = (int) ( (pageHeight - headerHeightOnPage) / oneRowHeight);
double pageHeightForTable = oneRowHeight *numRowsOnAPage;
int totalNumPages = (int) Math.ceil( ( (double) table.getRowCount()) / numRowsOnAPage);
if (pageIndex >= totalNumPages) {
return NO_SUCH_PAGE;
g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
//bottom center
g2.drawString("Page: " + (pageIndex + 1 + " of " + totalNumPages), (int) pageWidth / 2 - 35, (int) (pageHeight + fontHeight - fontDesent));
g2.translate(0f, headerHeightOnPage);
g2.translate(0f, -pageIndex * pageHeightForTable);
//If this piece of the table is smaller
//than the size available,
//clip to the appropriate bounds.
if (pageIndex + 1 == totalNumPages) {
int lastRowPrinted =
numRowsOnAPage * pageIndex;
int numRowsLeft =
table.getRowCount()
- lastRowPrinted;
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(oneRowHeight *
numRowsLeft));
//else clip to the entire area available.
else {
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(pageHeightForTable));
g2.scale(scale, scale);
printing = true;
try {
table.paint(g2);
finally {
printing = false;
//tableView.paint(g2);
g2.scale(1 / scale, 1 / scale);
g2.translate(0f, pageIndex * pageHeightForTable);
g2.translate(0f, -headerHeightOnPage);
g2.setClip(0, 0,
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(headerHeightOnPage));
g2.scale(scale, scale);
//table.getTableHeader().paint(g2);
//paint header at top
return Printable.PAGE_EXISTS;
class TableRenderDollar extends DefaultTableCellRenderer{
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean isFocused,
int row, int column) {
setHorizontalAlignment(SwingConstants.RIGHT);
Component component = super.getTableCellRendererComponent(
table,
value,
isSelected,
isFocused,
row,
column);
if( value == null || value .equals("")){
( (JLabel) component).setText("");
}else{
double number = 0.0;
number = new Double(value.toString()).doubleValue();
DecimalFormat df = new DecimalFormat(",##0.00");
( (JLabel) component).setText(df.format(number));
return component;
} -
Import tables with nested table : ORA-00600
In Oracle 9.2
Create object, type as table, and table with nested table (store as syms_ntab) are successfully.
Also its export.
In process of import on another server (also 9.2, 'fromuser=one touser=two') shows errors:
. . importing table "SYMS_NTAB"
IMP-00058: ORACLE error 600 encountered
ORA-00600: internal error code, arguments: [kokeeafi1], [2], [2], [], [], [], [], []
IMP-00075: Warning: The nested table may contain partial rows or duplicate rows
But for all that table is created and error occur on phase inserting strings.
What is this?
In Oracle 8.0.5 i perform similar operation without error.From Oracle error messages and codes manual:
ORA-00600 internal error code, arguments: [string], [string], [string], [string], [string], [string], [string], [string]
Cause: This is the generic internal error number for Oracle program exceptions. It indicates that a process has encountered a low-level, unexpected condition. Causes of this message include:
* timeouts
* file corruption
* failed data checks in memory
* hardware, memory, or I/O errors
* incorrectly restored files
The first argument is the internal message number. Other arguments are various numbers, names, and character strings. The numbers may change meanings between different versions of Oracle.
Action: Report this error to Oracle Support Services after gathering the following information:
* events that led up to the error
* the operations that were attempted that led to the error
* the conditions of the operating system and databases at the time of the error
* any unusual circumstances that occurred before receiving the ORA-00600 message
* contents of any trace files generated by the error
* the relevant portions of the Alter files
Note: The cause of this message may manifest itself as different errors at different times. Be aware of the history of errors that occurred before this internal error. -
PL/SQL add procedure with nested table - Duplicate Thread
Hi,
I am trying to do a procedure to input information for one order and another for 2 orders.
The information I have so far is as follows:
Drop table Orders cascade constraints;
Drop type item_type;
Drop type Item_nested;
Create or Replace Type item_type AS Object (
Cat_code Varchar2(6),
Amount_ord Number(3),
Cost Number(5,2) );
Create or Replace Type item_nested as table of item_type;
Create Table Orders (
Order_no Varchar2(8) constraint pkorder primary key,
Customer_name Varchar2(30),
AddressLine1 Varchar2(20),
AddressLine2 Varchar2(20),
AddressLine3 Varchar2(20),
Town Varchar2(20),
Postcode Varchar2(10),
Country Varchar2(20),
Order_items item_nested,
Order_date Date)
Nested Table Order_items
Store as nested_items return as locator;
This has so far worked but I have not managed the insert procedure.
I am using Oracle SQL*plus
Thanks
SG
Edited by: user10689875 on 11-Jan-2009 03:39Duplicate thread ->
PL/SQL add procedure with nested table
Please remove it & marked it as duplicate.
Regards.
Satyaki De. -
F4 Help with text table in WD abap
Hi,
i am using country related input help with check table T005 in one of table and i want to display the country text along with country id in my table, f4 for country is coming however if i select country from f4 it showing country id in the input field of table.
i want to have country text also in one of my input fields in the table, i have seen f4 help works if we have explicit search help and using parameter assignment we can have id and text defaulted if we use same context for id and text fields, however in this case country table t005 has check table t005 where texts are stored in text table t005t so web dynpro abap is't picking up the texts??
please suggest how can i get the texts as soon as i select country in the f4??Hi Kranthi,
You merely have to have an internal table storing list of countries, which you only need to do once, e.g. on load of application (method WDDOINIT of COMPONENTCONTROLLER). In your view, you have to declare a method for event onEnter of the input field, but this method doesn't have to have any code. Your code will be in method WDDOBEFOREACTION, where you read get country name from country key. Once you've got country name, transfer value to a context attribute to which you've already mapped as a source for attribute value of the UI element.
Check out SAP Webdynpro component FITV_IMG_DEFHTLCATA -> view V_ITEM. -
Trying to UNION two views with nested tables
I am using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod, and my objective is to generate some XML. What I have been doing in the past, is to create a view, and then pass that view to the DBMS_XMLQuery routine. This gives me a CLOB that I pass along to the application. A typical object would be something like:
create or replace type XML_UGroup_Member_Type as object (
username varchar2(128),
group_key varchar2(128));
create or replace type XML_UGroup_Member_List
as table of XML_UGroup_Member_Type;
show errors
Create or replace type XML_UGroup_Type as object (
Group_Space varchar2(32),
group_key varchar2(128),
group_name varchar2(255),
members XML_UGroup_Member_List);
/This particular application will be doing stuff with group information. Pretty simply types - a group with a name and a few other keys, and a list of members. A sample view would be like:
create or replace view xml_department_ugroup_view of xml_ugroup_type
with object identifier ( group_key ) as
Select 'Department',
'Department:' || orgn_code,
'Department_' || orgn_name
cast ( multiset (
select Username, person_id,
'Department:' || effective_orgn
from directory_master dm, logins l
where effective_orgn = dd.orgn_code
and dm.person_id = l.owner)
as XML_UGroup_Member_List )
as members
from directory_departments dd
where dept_include = 'Y';
can select from this view, and I can pass it to the DBMS_XMLQUERY package and get a nice XML document. What I want to is essentially put several of these views together, like
Select * from XML_Department_Ugroup_View
Union
Select * from XML_Portfolio_Ugroup_View;But UNION does not work with nested tables:
ERROR at line 1: ORA-00932: inconsistent datatypes: expected - got SIMON.XML_UGROUP_MEMBER_LIST
What I was hoping to do, was to develop a set of sub views for each of the group "spaces", and then generate a view/object that includes all of the sub views, and be able to operate with that single object.
Thoughts on how to make this work, or on alternate approaches? I have considered calling XMLQuery on each of the sub views and concatenating the XML documents and returning that to the application, but I was hoping to find a more "unified" approach.I modified my approach a bit - I changed the base views to return an XMLType object, like:
create or replace view xml_portfolio_ugroup_xml
as
Select XMLElement("group",
xml_ugroup_type(
'Portfolio',
'Portfolio:' || coas_code || ':' || orgn_Code,
cast ( multiset (
select Username,
from directory_master dm, logins l
where ( effective_orgn, effective_coas ) in
where effective_orgn = dd.orgn_code
and dm.person_id = l.owner
as XML_UGroup_Member_List ))) as grp
from directory_departments dd
where dept_include = 'Y';and then I combined them with something like the following (I expect to adjust this as I learn more about the XML DB support)
create or replace view xml_ugroup_xml as
select xmlconcat(
(select xmlagg(grp) from xml_department_ugroup_xml),
(select xmlagg(grp) from xml_portfolio_ugroup_xml)
) as GROUPS
from dualand as I define more group branches, I can add them into the XMLConCat stanzas. I am still open to suggestions as to ways of doing this better or cleaner, but this at least gets the project moving forward again. -
Hello All,
I need some help with custom tables. I have created a custom table to maintain names and I also did table maintenance generation so that the user can maintain names in this table using SM30 transaction.
The question is, in my program on the selection screen when the user press F4 I need to display the values maintained in this custom table...
Can anyone help me with this.
Thanks
PavanIf I understood you correctly, you have a program in which one or some of the selection screen fields refer to a custom database table field(s).
You want to implement a F4 functionality.
Fill an internal table with the values you want to show.
Call the function module 'F4IF_INT_TABLE_VALUE_REQUEST' in the event AT SELECTION-SCREEN ON VALUE-REQUEST FOR MYPARAM as follows.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = MYITAB-FIELD
dynprofield = MYSELSCREENPARAM
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = my_f4_itab.
Srinivas -
Inserting data with the help of nested table...!!!
The following block is giving error
ORA-06502: PL/SQL: numeric or value error
the signature and signature_bkp have the same structure
So, can anybody help me out to solve this issue :
for copying records from one table to another table
Thanking You advancely
DECLARE
CURSOR c1
IS
SELECT *
FROM signature
WHERE creation_time > TRUNC ( SYSDATE ) - 100
AND ROWNUM < 102;
TYPE sig_typ IS TABLE OF signature%ROWTYPE;
sig_t sig_typ;
BEGIN
OPEN c1;
FETCH c1
BULK COLLECT INTO sig_t;
CLOSE c1;
FORALL i IN sig_t.FIRST .. sig_t.LAST
INSERT INTO signature_bkp
VALUES sig_t ( i );
COMMIT;
END;
--DKarOr whether a INSERT statement with SELECT clause will do that for youby using this technique, it took 47:08:45 to copy 7252 rows
and by using a cursor for loop took 49:03:23 to copy 13567 rows
So there was appox. 40% increase in performance by using pl/sql. I thought it could be even faster using the bulk-bind ing features and nested tables.
OR i just want to know ....how to correct the block of code that was given in my 1st msg without changing its logic.
Thanks
--DKar -
Help needed with nested tables
I have two identical relations R and S defined as:
CREATE TYPE table_typ AS TABLE OF VARCHAR2(8);
CREATE TABLE R(
a INTEGER,
b table_type)
NESTED TABLE b STORE as b_1;
CREATE TABLE S(
a INTEGER,
b table_type)
NESTED TABLE b STORE as b_2;
Both have two tuples each:
INSERT INTO r VALUES (1, table_type('a','b'));
INSERT INTO r VALUES (2, table_type('d'));
INSERT INTO s VALUES (1, table_type('b','c'));
INSERT INTO s VALUES (3, table_type('e'));
Would it be possible to write a query that "unions" R and S so that nested tables in tuples (in R and S) that agree on the A attribute are merged together, while tuples that do not agree on A still appear in the result? That is, the result I am looking for is:
A B
1 TABLE_TYPE('a','b','c')
2 TABLE_TYPE('d')
3 TABLE_TYPE('e')
I've tried a simple union, but it does not work. Any help on this would be greatly appreciated.
Thanks,
LauraI don't have 10g, but the following is a 9i solution. I know there has to be a better way. About all I can say for the code below is that it works. I am only posting it because it is better than nothing, until somebody with 10g posts something better. I have included the stragg function by Tom Kyte.
scott@ORA92> -- test data:
scott@ORA92> CREATE OR REPLACE TYPE table_type AS TABLE OF VARCHAR2 (8);
2 /
Type created.
scott@ORA92> CREATE TABLE r(
2 a INTEGER,
3 b table_type)
4 NESTED TABLE b STORE as b_1
5 /
Table created.
scott@ORA92> CREATE TABLE s(
2 a INTEGER,
3 b table_type)
4 NESTED TABLE b STORE as b_2
5 /
Table created.
scott@ORA92> INSERT INTO r VALUES (1, table_type('a','b'));
1 row created.
scott@ORA92> INSERT INTO r VALUES (2, table_type('d'));
1 row created.
scott@ORA92> INSERT INTO s VALUES (1, table_type('b','c'));
1 row created.
scott@ORA92> INSERT INTO s VALUES (3, table_type('e'));
1 row created.
scott@ORA92> commit
2 /
Commit complete.
scott@ORA92> -- start of code from Tom Kyte:
scott@ORA92> create or replace type string_agg_type as object
2 (
3 total varchar2(4000),
4
5 static function
6 ODCIAggregateInitialize(sctx IN OUT string_agg_type )
7 return number,
8
9 member function
10 ODCIAggregateIterate(self IN OUT string_agg_type ,
11 value IN varchar2 )
12 return number,
13
14 member function
15 ODCIAggregateTerminate(self IN string_agg_type,
16 returnValue OUT varchar2,
17 flags IN number)
18 return number,
19
20 member function
21 ODCIAggregateMerge(self IN OUT string_agg_type,
22 ctx2 IN string_agg_type)
23 return number
24 );
25 /
Type created.
scott@ORA92> create or replace type body string_agg_type
2 is
3
4 static function ODCIAggregateInitialize(sctx IN OUT string_agg_type)
5 return number
6 is
7 begin
8 sctx := string_agg_type( null );
9 return ODCIConst.Success;
10 end;
11
12 member function ODCIAggregateIterate(self IN OUT string_agg_type,
13 value IN varchar2 )
14 return number
15 is
16 begin
17 self.total := self.total
18 || ','
19 || value;
20 return ODCIConst.Success;
21 end;
22
23 member function ODCIAggregateTerminate(self IN string_agg_type,
24 returnValue OUT varchar2,
25 flags IN number)
26 return number
27 is
28 begin
29 returnValue := ltrim(self.total,',');
30 return ODCIConst.Success;
31 end;
32
33 member function ODCIAggregateMerge(self IN OUT string_agg_type,
34 ctx2 IN string_agg_type)
35 return number
36 is
37 begin
38 self.total := self.total || ctx2.total;
39 return ODCIConst.Success;
40 end;
41
42
43 end;
44 /
Type body created.
scott@ORA92> CREATE or replace
2 FUNCTION stragg(input varchar2 )
3 RETURN varchar2
4 PARALLEL_ENABLE AGGREGATE USING string_agg_type;
5 /
Function created.
scott@ORA92> -- end of code from Tom Kyte
scott@ORA92> -- usage of above function:
scott@ORA92> COLUMN c FORMAT A15
scott@ORA92> SELECT a, stragg (column_value) AS c
2 FROM (SELECT t1.a, t1.column_value
3 FROM (SELECT r.a, c.column_value
4 FROM r, TABLE (r.b) c) t1,
5 (SELECT s.a, d.column_value
6 FROM s, TABLE (s.b) d) t2
7 WHERE t1.a = t2.a
8 UNION
9 SELECT t1.a, t2.column_value
10 FROM (SELECT r.a, c.column_value
11 FROM r, TABLE (r.b) c) t1,
12 (SELECT s.a, d.column_value
13 FROM s, TABLE (s.b) d) t2
14 WHERE t1.a = t2.a)
15 GROUP BY a
16 UNION ALL
17 SELECT a, stragg (column_value) AS c
18 FROM (SELECT t1.a, t1.column_value
19 FROM (SELECT r.a, c.column_value
20 FROM r, TABLE (r.b) c) t1,
21 (SELECT s.a, d.column_value
22 FROM s, TABLE (s.b) d) t2
23 WHERE t1.a = t2.a (+)
24 AND t2.a IS NULL
25 UNION
26 SELECT t2.a, t2.column_value
27 FROM (SELECT r.a, c.column_value
28 FROM r, TABLE (r.b) c) t1,
29 (SELECT s.a, d.column_value
30 FROM s, TABLE (s.b) d) t2
31 WHERE t1.a (+) = t2.a
32 AND t1.a IS NULL)
33 GROUP BY a
34 /
A C
1 a,b,c
2 d
3 e
Maybe you are looking for
-
Error while generating PDF BI 7 Report Designer
Hi, I am getting this error Error while generating PDF when i tried print version on report designer, I tried to find information on this error but there was no information regarding this , so posted here. Please let me know if you have any suggestio
-
Flex 2-15 Keyboard/Trackpad no longer working
Basically the keyboard/trackpad are no longer working for my lapop (Flex 2-15). Here's the run down of what I know: 1) Function keys still work such as brightness up or down and turning off the screen. 2) In device manager there is the yellow traigle
-
Got some avi files from a client yesterday and I am only able to hear the audio. The video portion is all white. I have tried playing the file with RealPlayer, VLC, QT Pro and Flip4Mac but nothing. I tried converting the file with Cleaner 6.5 and Div
-
Process: Knights of the Old Republic [385] Path: /Applications/Knights of the Old Republic.app/Contents/MacOS/Knights of the Old Republic Identifier: com.aspyr.kotor Version: 1.3.8 (1.3.8) App Item ID: 416608891 Ap
-
CS to CS3, can i export Actions?
Hi all, upgraded from CS to CS3. But i have a ton of Actions in CS - can someone tell me how to export the Actions from CS to CS3? Thanks.