Procedure to INSERT with data as IN Parameters O-R Nested Table
Hello Friends
I'm a newbie and learning oracle 10G. I've the following DML INSERT statements which are working fine. I was hoping to convert these into a procedure with data as input parameters and so far achieved nothing. Could anyone please help me in writing a procedure for this ? Any code or even pointers in the right direction is highly appreciated. I've read in other forum posts that procedures are slow and in efficient, but as a beginner I just want learn the concepts.
INSERT INTO tab_cust
VALUES (
1, 'Ray Bloggs',
obj_addr('51 Local Close', 'Nomansland', 'Sussex', 'GU6 9UI'),
var_phoneList('123456','7891011')
INSERT INTO tab_po
SELECT 1001, REF(C),
SYSDATE, '10-MAY-2009',
tab_lineitem(),
NULL
FROM tab_cust C
WHERE C.CustomerNo = 1 ;
INSERT INTO TABLE (
SELECT P.LineItemList_nestab
FROM tab_po P
WHERE P.PONo = 1001
values(11233, 12, 500);
INSERT INTO TABLE (
SELECT P.LineItemList_nestab
FROM tab_purchaseorder P
WHERE P.PONo = 1001
values(11234, 90, 900);
Thanks and Regards
Guess the below link should help you to get started:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/overview.htm#sthref196
Similar Messages
-
Stored procedure to insert/update data ?
Hi,
i have a stored procedure which checks for a specified user and a specified timespan (from - to) its allocations on tasks. The timespan is cut into 30-minute fragments by the SP.
Very abstract model
TASK (zero to many) REQUIRED_RESOURCE (zero to many) ALLOCATED_USERThe stored procedure returns a ref cursor with the following columns. The TASK_ID can be null which means there is no allocation between that START_TIME and STOP_TIME. Otherwise the user is allocated on that specific task. Because the data is cut into 30-minute fragments, STOP_TIME is always 30 minutes after START_TIME.
START_TIME, STOP_TIME, USER_ID, TASK_IDAll good so far.
I would like to store the data returned by the SP in a table. This allows me for more flexible use of the data. I'm thinking of storing the data as follows (STOP_TIME isn't really needed for storing...):
START_TIME (pk)
USER_ID (pk)
TASK_ID (null)**How can I somehow 'process' the ref-cursor returned by the SP, so that data in my new table is inserted if the START_TIME + USER_ID combination doesn't exist yet or updated if it already exists?**
Thanks for thinking along!
This is the SP for reference (TRUNC30 is a function that Truncates a DateTime value to the nearest 30-minute part):
create or replace
PROCEDURE REPORT_PLAN_AV_USER
from_dt IN date,
to_dt IN date,
sysur_key IN number,
v_reservations OUT INTRANET_PKG.CURSOR_TYPE
IS
BEGIN
OPEN v_reservations FOR
with
MONTHS as (select FROM_DT + ((ROWNUM-1) / (24*2)) as DT from DUAL connect by ROWNUM <= ((TO_DT - FROM_DT) * 24*2) + 1),
TIMES as (select DT as START_TIME,(DT + 1/48) as STOP_TIME from MONTHS where TO_NUMBER(TO_CHAR(DT,'HH24')) between 8 and 15 and TO_NUMBER(TO_CHAR(DT,'D')) not in (1,7))
select
TIMES.START_TIME,
TIMES.STOP_TIME,
T.TASK_ID,
sysur_key USER_ID,
from
TIMES
left outer join (ALLOCATED_USER u INNER JOIN REQUIRED_RESOURCE r ON u.AU_ID = r.RR_ID INNER JOIN TASK t ON r.TASK_ID = t.TASK_ID)
ON u.USER_ID = sysur_key AND t.PLAN_TYPE = 3 AND TIMES.start_time >= TRUNC30(t.START_DATE) AND TIMES.start_time < TRUNC30(t.FINISH_DATE)
where u.USER_ID is null OR u.USER_ID = sysur_key
order by START_TIME ASC;
END;Hi,
user574699 wrote:
So I should MERGE ON (start_time AND user_id) if i'm correct?Right: the ON condition will be a compound condition; both the time and the user_id have to be the same if the rows match.
Oh, and is is possible to 'encapsulate' the MERGE statement in the SP? Or should I write another SP that selects from the output cursor as input for the MERGE statement?There's no need for a cursor or a second procedure.
If the query you posted is producing what you want, just put it in the USING clause as it is, except that you won't need an ORDER BY clause. -
How to insert test data of 10,000 records into emp table
Hi I'm new to oracle can anyone please help me in writing a program so that i can insert test data into emp table
Hi,
user11202607 wrote:
thanks sanjay , frank . But how can i insert only 4 deptno's randomly and how can i insert only 10 managers randomly ,
Sorry to pull Your legs and thanks for bearing my question. I want to insert into emp table where it has the empno, ename, sal, job, hiredate, mgr and deptnoThis should give you some ideas:
INSERT INTO emp (empno, ename, sal, job, hiredate, mgr, deptno)
SELECT LEVEL -- empno
, dbms_random.string ('U', 4) -- ename
, ROUND ( dbms_random.value (100, 5000)
, -2
) -- sal
, CASE
WHEN LEVEL = 1 THEN 'PRESIDENT'
WHEN LEVEL <= 4 THEN 'MANAGER' -- Change to 11 after testing
WHEN dbms_random.value < .5 THEN 'ANALYST'
WHEN dbms_random.value < .5 THEN 'CLERK'
ELSE 'SALESMAN'
END -- job
, TRUNC ( SYSDATE
- dbms_random.value (0, 3650)
) -- hiredate
, CASE
WHEN LEVEL > 1
THEN TRUNC (dbms_random.value (1, LEVEL))
END -- mgr
, TRUNC (dbms_random.value (1, 5)) -- deptno
FROM dual
CONNECT BY LEVEL <= 10 -- Change to 10000 after testing
;The interesting part (to me, at least) is mgr. What I've done above is guarantee that the mgr-empno relationship reflects a tree, with the 'PRESIDENT' at its sole root. The tree can be any number of levels deep.
Sample results:
EMPNO ENAME SAL JOB HIREDATE MGR DEPTNO
1 GDMT 2800 PRESIDENT 30-AUG-04 2
2 CVQX 400 MANAGER 24-MAY-06 1 2
3 QXJD 1300 MANAGER 17-JUN-05 1 4
4 LWCK 4800 MANAGER 15-JUN-06 2 2
5 VDKI 3700 CLERK 08-SEP-01 4 2
6 FKZS 2600 CLERK 18-DEC-06 4 1
7 SAKB 700 ANALYST 30-JUN-00 5 4
8 DVYY 300 ANALYST 22-SEP-01 2 1
9 CLEO 2700 ANALYST 27-MAY-08 5 4
10 RDVQ 3400 ANALYST 14-DEC-08 5 4For details on the built-in packages (such as dbms_random) see the [Parckages and Types manual|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_random.htm#i998925]. -
I want to insert data into a gta from a nested table
Hi,
I want to insert data into a global temporary table from nested table.
How do i do it?cursor cc is select * from t1;
TYPE temp_rec_tab IS TABLE OF temp_rec_tap_cur%ROWTYPE;
TYPE rec_num_tab1 is table of temp_records_tap.record_num%type;
v_test_tab temp_rec_tab;
---- v_rec_num num_tab;
v_rec_num rec_num_tab1;
v_filename temp_records_tap.file_name%TYPE;
v_error_code tap_reject.ERROR_CODE%TYPE;
v_rej_value tap_reject.field_rej%TYPE;
v_count NUMBER;
BEGIN
OPEN cc;
LOOP
BEGIN
FETCH cc
BULK COLLECT INTO v_test_tab LIMIT 1000;
FORALL i IN v_test_tab.FIRST .. v_test_tab.LAST SAVE EXCEPTIONS
INSERT INTO tt2
VALUES v_test_tab (i)
RETURNING record_num
BULK COLLECT INTO v_rec_num;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
EXIT WHEN temp_rec_tap_cur%NOTFOUND;
FORALL i in v_rec_num.first..v_rec_num.last
INSERT INTO record_num_session values v_rec_num(i); ------- v_num(i) INVALID IDENTIFIER ??????
END LOOP;
END; -
Hi,
I've a problem with an insert, I wont to insert a record with one date column that I extract from data_picker_item, like this:
insert into backup_adm.tmp_job_runs@REP920DC_LNK values
(:P3_OPCO,
16642,
to_char(to_date(:P3_TIMESTAMP,'DD/MM/YYYY hh24:mi')),
to_date('05/11/09 18:34','dd/mm/yy hh24:mi'),4,-1,2,1);
I.ve receive this error:
ORA-01461: can bind a LONG value only for insert into a LONG column ORA-02063: preceding line from REP920DC_LNKALWAYS use a column list of the columns being inserted in the INSERT statement.
insert into backup_adm.tmp_job_runs@REP920DC_LNK
(column1, column2, ...)
values
(value1, value2, ...)If doing this doesn't fix the problem, post a description of the table. -
How to avoid grouping by date with dates as incoming parameters?
Hello, I have the following Query from SAP Business One set as DataSource:
SELECT T1.SlpName as 'Vendor', convert(varchar(12), T0.[U_ER_PROV])as 'City', T0.[CardCode] as 'Client Code', T3.CardName as 'Client Name', T0.DocDate as 'Date', T2.ItemCode, T4.ItemName as 'Reference Description', sum (T2.Quantity) as 'Toal Units per Reference',
avg (T2.Price)as 'Average Price', sum(T2.LineTotal) as 'Total'
FROM ODLN T0
INNER JOIN OSLP T1
ON T0.SlpCode = T1.SlpCode
INNER JOIN DLN1 T2
ON T0.DocEntry = T2.DocEntry
INNER JOIN OCRD T3
ON T0.CardCode = T3.CardCode
INNER JOIN OITM T4
ON T2.ItemCode = T4.ItemCode
group by T1.SlpName, convert(varchar(12), T0.[U_ER_PROV]), T0.[CardCode], T4.ItemName, T0.DocDate, T2.ItemCode, T3.CardName
order by T1.SlpName, convert(varchar(12), T0.[U_ER_PROV]), T0.CardCode, T0.DocDate, T2.ItemCode
What I´d like to do is, grouping in Crystal Reports, the result of this query by Item Code, not by date. The problem I have is that I need users introduce "from date" to "end date" as incoming paramater.
The way I am running it, for example I have some results like:
date Item Code Total
01/01/2009 4646_R2 120 u20AC
10/01/2009 4646_R2 34 u20AC
And I´d like to take something like this:
Item code Total
4646_R2 154 u20AC
Not grouping by date ......
Is there any way to do this using this query in Crystal Reports?
Thanks very much for your time.
Miguel A. VelascoHello all, thanks very much to Raghavendra for his helpfully answer.
I followed your coments and now the report is running fine.
Thanks again for your help without expecting anything in return.
Miguel Velasco -
Dynamic insertion of data in a Dynamic Column in a table
Hi EveryBody ,
I have a table where i am increasing the column dynamically . I need to insert data through PreparedStatement Like
pst = con.prepareStatement(CBBsqlConstants.addOrderItem);
pst.setString(1,ein);
pst.setString(2,insert_date);
pst.setString(3,checkList);
pst.setString(4,Quantities);
pst.setDate(5,pick_date);
pst.setDate(6,completed_date);
pst.setString(7,comment);
pst.setInt(8,status);
pst.setString(9,agent_ein);
i = pst.executeUpdate();
But here my column is increasing dynamically, so the above cant be constant as column is incresing . how do i handle the insertion part dynamically.
Thanks So much . Please help with this .Server_java wrote:
Ya you are right ,
Take i am ordering some Items and quantity from checkbox and inserting that to the table , each item and quantity is going to consume a row , but when i am going have column for each item , all the items i am going to select is going to appear in a single row . so i am consuming .But only 256 column is allowed for a table ,but my item is not going to excced that . That maximum number of columns is the least of the problems here.
The problem is that you are taking data that should be in another table and turning it into metadata instead. That's a mistake because it makes your entire application brittle and it doesn't need to be. It also will make querying your table a nightmare.
Let's take a look at your solution and then the correct solution.
Your solution (condensed)
tblOrder
id
customername
apples
oranges
bananas
cherries
Sample data (CSV format for the forum)
1,"John Smith",0,0,0,1
2,"Jane Smith",1,0,0,3
3,"Kate Smith",0,2,1,0
The correct solution
tblOrder
id
customername
Sample data
1,"John Smith"
2,"Jane Smith"
3,"Kate Smith"
tblProduct
id
name
Sample data
1, "Apples"
2,"Oranges"
3, "Bananas"
4, "Cherries"
tblOrderItem
orderid
productid
quantity
Sample data
1,4,1
2,1,1
2,4,3
3,2,2
3,3,1
So what's the difference?
With your design what happens when you want to add a new fruit? Your schema changes and all your code breaks. With my design you simply insert one row and that's it.
And what happens if you do happen to eventually need more than 250 odd fruits? With your design you are screwed. With my correct design it's never going to be a problem.
And consider that with my design you can populate user inteface components using actual data and not table meta data.
And the list goes on... the point is the only correct solution is to use a proper relational design. -
Insert XML data into a diferents fiels in a TABLE.
We have an xml to import in to a table with XMLType of fields.
The xml file has on field that the content of that field is a full xml file.
Example.
<BD>
<J>
<T> 1212 </T>
</J>
<BDI>
<INFO><?xml version="1.0" encoding="UTF-8"?> <BuriedDropTask xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="buriedDropSchema.xsd"> <TaskName>UTFS277779</TaskName>.......
<PhoneNumber>303303033</PhoneNumber>......
</INFO>
</BDI>
</BD>
This is just an idea and not the actual document.
We need to insert in a table the data from <J> </J> and some fields of the ineer document like <BuriedDropTask> </BuriedDropTask> to other field in the same table to process the data.
What is the rigth process to follow?
The previus programmer was using utl_http.request_pieces to read the xml from an url and acummulated in a varchar2 variable. But the process is not working.
Thank you for your help in advance.
Jose GalanThe XML file with <?xml?> somewhere inside the tags is not valid.
I think, at first stage the unneeded garbage should be striped of with replace/instr/whatever.
Then extract() functions should be applied to bulk process the XML.
insert into tasks (id, t, task_name)
select tasks_seq.nextval
t,
task_name
from (
select extractvalue(xml, '//J/T') t,
extractvalue(xml, '//BDI/INFO/TaskName') task_name
from (
select extract(xml, '/BD') xml from xml_table
) -
Refresh page with data from the Next Record in the Table through a Button
Scenario: Record of a table “prototype” is made up of 8 columns,
key_col,
text_col,
label1_col, label2_col, label3_col,
check1_col, check2_col, check3_col,
I have created the following items on a page:
a) A Display Only item that is populated through a SQL query
“SELECT text_col from prototype where rownum=key_seq.NEXTVAL “.
b) Hidden item for the database columns “label1_col, label2_col, label3_col”
Source type for the hidden items is of type SQL query, Source expression is:
Select label1_col from prototype where rownum=key_seq.NEXTVAL ;
Select label2_col from prototype where rownum=key_seq.NEXTVAL ;
Select label3_col from prototype where rownum=key_seq.NEXTVAL ;
(key_seq is a sequence).
c) Checkbox item for the database columns “ check1_col, check2_col,check3_col"
d) The labels for the above checkbox items are &label1_col. , &label2_col. , &label3_col.
I have created a Save button to save the state of the checkboxes; (STATIC:;1 )
I want the page to be refreshed with the data from the next record (Fields text_col, label1_col, label2_col, label3_col) through a “ Next” Button.
Can I please know how I can achieve this?
Thanks in advanceIf you need the value that is entered in the textbox as the email body, then try this..
<html>
<HEAD>
<title>WebForm1</title>
<script language="javascript">
function mailHTML() {
var content=document.getElementById('textBox').value;
location.href="mailto:?body="+encodeURI(content);
</script>
</head>
<body>
<form name="theform" id="theform">
<div name="body1"/>
<input type="text" value="Test" id="textBox"/>
<input type="button" value="Send Email" onClick="mailHTML()"/>
</div>
</form>
</body>
</html> -
Stored Procedures with Date data types and Oracle
This should be easy.... But i keep getting the error:
[Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1,
column 7: PLS-00306: wrong number or types of arguments in call to
'RETRIEVE_TS' ORA-06550: line 1, column 7: PL/SQL: Statement
ignored
And I got it worked out to where i know it is a problem with
the way i am using the date data types in a stored procedure....
In the past i usually avoided calling procedures in Oracle
with date as the in type.... It is always easiest to let oracle
convert the string to a date.... Unfortunately now i am stuck with
having a date type in the procedure call.... So the question is:
WHAT IS THE PROPER WAY TO SUBMIT DATE/TIME STAMP IN A STORED
PROCEDURE?
The Oracle Procedure looks like this:
PROCEDURE retrieve_ts (
p_at_tsv_rc IN OUT sys_refcursor,
p_units IN OUT VARCHAR2,
p_officeid IN VARCHAR2,
p_timeseries_desc IN VARCHAR2,
p_start_time IN DATE,
p_end_time IN DATE,
p_timezone IN VARCHAR2 DEFAULT 'GMT',
p_trim IN NUMBER DEFAULT false_num,
p_inclusive IN NUMBER DEFAULT NULL,
p_versiondate IN DATE DEFAULT NULL,
p_max_version IN NUMBER DEFAULT true_num
AND the stored procedure call looks like this:
<cfset ed = Now()>
<cfset sd = #DateAdd("d",-lbt,Now())#>
<cfstoredproc datasource="CWMS"
procedure="cwms.cwms_ts.retrieve_ts"
returncode="no">
<cfprocparam type="inout" variable="unit" value="#unit#"
dbvarname="@p_units"
cfsqltype="cf_sql_varchar">
<cfprocparam type="in" value="MVS"
dbvarname="@p_officeid"
cfsqltype="cf_sql_varchar">
<cfprocparam type="in" value=#id.cwms_ts_id#
dbvarname="@p_timeseries_desc"
cfsqltype="cf_sql_varchar">
<cfprocparam type="in" value="#sd#"
dbvarname="@p_start_time"
cfsqltype="cf_sql_date">
<cfprocparam type="in" value="#ed#"
dbvarname="@p_end_time"
cfsqltype="cf_sql_date">
<cfprocparam type="in" value="#tz#"
dbvarname="@p_time_zone"
cfsqltype="cf_sql_varchar">
<cfprocparam type="in" value="0"
dbvarname="@p_trim"
cfsqltype="cf_sql_numeric">
<cfprocparam type="in" value=""
null = "yes"
dbvarname="@p_inclusive"
cfsqltype="cf_sql_numeric">
<cfprocparam type="in" value=""
null="yes"
dbvarname="@p_versiondate"
cfsqltype="cf_sql_date">
<cfprocparam type="in" value="1"
dbvarname="@p_max_version"
cfsqltype="cf_sql_numeric">
<cfprocresult name="ts_dat">
</cfstoredproc>
TextYeah.... One is a type INOUT ref cursor.... which is denoted
by the cfprocresult....
By the way:
Phil - the code example with a little tweaking worked fine on
my machine....
<<cfstoredproc procedure="test_pkg.test"
datasource="myDSN" returncode="no">
<cfprocparam type="IN" cfsqltype="cf_sql_timestamp"
value="15-JUN-2005">
<cfprocparam type="OUT" cfsqltype="cf_sql_varchar"
variable="v_out">
<cfprocresult name="rs1">
</cfstoredproc>
PROCEDURE test(
v3_out OUT ref_cur_type,
v1_in IN date default null,
v2_out OUT varchar2
IS
BEGIN
v2_out := TO_CHAR(v1_in, 'mm/dd/yyyy');
OPEN v3_out
FOR
SELECT *
FROM user
WHERE activation_date >= v1_in;
END test;
Why do i still get this error......
Here is what it looks like now:
PROCEDURE retrieve_ts (
p_at_tsv_rc IN OUT sys_refcursor,
p_units IN OUT VARCHAR2,
p_officeid IN VARCHAR2,
p_timeseries_desc IN VARCHAR2,
p_start_time IN DATE,
p_end_time IN DATE,
p_timezone IN VARCHAR2 DEFAULT 'GMT',
p_trim IN NUMBER DEFAULT false_num,
p_inclusive IN NUMBER DEFAULT NULL,
p_versiondate IN DATE DEFAULT NULL,
p_max_version IN NUMBER DEFAULT true_num
<cfstoredproc datasource="CWMS"
procedure="cwms.cwms_ts.retrieve_ts"
returncode="no">
<cfprocparam type="INOUT" variable="p_units"
value="#unit#" <!---p_units--->
cfsqltype="cf_sql_varchar">
<cfprocparam type="IN" value="MVS"
<!---p_officeid--->
cfsqltype="cf_sql_varchar">
<cfprocparam type="IN" value=#id.cwms_ts_id#
<!---p_timeseries_desc--->
cfsqltype="cf_sql_varchar">
<cfprocparam type="IN" value="#sd#"
<!---p_start_time--->
cfsqltype="cf_sql_timestamp">
<cfprocparam type="IN" value="#ed#"
<!---p_end_time--->
cfsqltype="cf_sql_timestamp">
<cfprocparam type="IN" value="#tz#"
<!---p_timezone--->
cfsqltype="cf_sql_varchar">
<cfprocparam type="IN" value="0" <!---p_trim--->
cfsqltype="cf_sql_integer">
<cfprocparam type="IN" value=""
<!---p_inclusive--->
null = "yes"
cfsqltype="cf_sql_numeric">
<cfprocparam type="IN" value=""
<!---p_versiondate--->
null="yes"
cfsqltype="cf_sql_timestamp">
<cfprocparam type="IN" value="1"
<!---p_max_version--->
cfsqltype="cf_sql_integer">
<cfprocresult name="ts_dat">
<!---sys_refcursor--->
</cfstoredproc>
If I truly am short a parameter, How do you specify the INOUT
sys_refcursor? -
What I do this I create a new user following with a new location and module.
Then I import(imp user/pass@orcl file=location full=y) my .dmp file. And everything seems to be working.
Then I import my data into OWB, I get everything I need. I check the data by (right-click data) and everything is fine, the tables are inserted with data.
Then I try to deploy the new tables, with action(create) I get 2 erros CREATE - (tablename is already in use) DROP - Cannot because of FK etc. (I guess it tried to create one table then couldnt then tried to drop it)
My second action then is (replace) which leads me to my deploy sucess and then all of my data is missing. The tables are empty..
My question is how can I deploy without losing my data..
CheersTypically you would import the metadata from the source location and either use that location as the data source (and so not need to redeploy), or deploy it to a separate target location.
The replace action is destructive as you've found, and effectively performs a drop table followed by create table. Hence any data in the table is lost.
If you just want the Control Center Manager to correctly display that the table is deployed, try setting the action to "Upgrade". This will try to upgrade the deployed object to match the definition in OWB, but as the two are identical this will result in no changes. However, it will update the deployment records to indicate that the object is deployed.
Nigel. -
On order Stock and stock in transit with date variable
Hi experts.
İt may be an easy question.
We need to see on order stock (menge,can be seen T code MMBE) and stock in transit(T CODE MB5T) with date variable.
Any T code or table...?
I mean that for exp: on order stock and sttock in transit on 02/02/2012..
Thanks in advance..Hi,
as per my knowledge you have to develop report using following table
how many Po closed for material
how many MIGO happens and how many remain etc
table EKPO
EKKE
EKBE
MSEG
MKPF
[Report|http://wiki.sdn.sap.com/wiki/display/ERPLO/SAPStandardReports]
[tables req to get date wise stock report;
Regards
Kailas Ugale -
Rename the existing table with date suffix
Hi,
I'm trying to rename a table with date suffix at the end of the table name, and drop the date suffix table which is greater than 7 days. for that I have the below sql, I have not included the drop syntax in this.
I'm not able to rename with the date suffix in the below sql, syntax error at '+'
DECLARE
@TPartitionDate date
IF EXISTS (SELECT * FROM sysobjects WHERE Name = 'IIS_4')
BEGIN
SELECT
@TPartitionDate = MAX(PartitionDate)
FROM PartitionLog (NOLOCK)
EXEC sp_rename 'IIS_4','IIS_4_'+ @TPartitionDate
ENDcreate table Test(sno int)
DECLARE
@TPartitionDate date = getdate()
declare @a varchar(200)
IF EXISTS (SELECT * FROM sysobjects WHERE Name = 'Test')
BEGIN
select @a='TEST_'+ cast(@TPartitionDate as varchar(10))
EXEC sp_rename 'TEST',@a
END
drop table [test_2015-04-23]
Hope it Helps!! -
Table - populate one table with data from the list of another table
Hello All,
I am a newbie in Swing and am a book and few tutorials old.
I am trying to achieve the following:
(1) I populate Table1 (a JTable) with a list of data - each row consists of several columns. And I have a Table2 (also JTable) that is in the beginning empty.
Both the tables (Table1 and Table2) are showed in the window.
(2) Lets say, there's a button (JButton) in between the two tables.
Now if I Select a row from Table1 and press the button, this row will be sent/copied to Table2.
And this way I can choose different rows and pass the data to Table2.
I have manages to make Table1 and put data in it ... but for the rest, I don't know where and how to begin.
Would appreciate some ideas and tips.
Thank you.Since you are using a button to start the copy process you don't need to worry about a ListSelectionListener or a MouseListener. You need to create a button with an ActionListener that does the following:
a) Create an Array based on the size of the number of columns in the table
b) get the index of the selected row
c) populate the Array with data from the TableModel by using the table.getModel().getValueAt(...) method for each
d) Now you can add the row of data to the other JTable by updating its model.
DefaultTableModel model2 = (DefaultTableModel)table2.getMode();
model.addRow( theArray ); -
Rolling upgrade with Data Guard
I'm interesting if this table of possible upgrade from documentation (http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/preup.htm#i1007814) is true, if I have a plan to do rolling upgrade with Data Guard?
I thinking no, that table does not appear to have Rolling Upgrade Information.
If I read the document correctly you can only this with a logical standby database in Data Guard.
Larry Carpenter's book has some information on this in Chapter 11.
There is also a separate Data Guard section here where you might find more information.
Data Guard
Best Regards
mseberg
Maybe you are looking for
-
Desktop icons wont open when clicked on
Hi to all Happy New Year just installed Leopard on both of my computers- on Macbook -desktop icons open when clicked on but not on my Imac computer- tried restarting numerous time any suggestions. Any thoughts. Kevin
-
Horizontal Menu problem in Firefox and Safari
I have created a Spry Widget horizontal menu bar in my template .dwt. This menubar worked fine at first in IE7, Firefox3, and Safari 3 and 4, but now that all pages are in place, it displays incorrectly in Firefox and Safari. Specifically, for each d
-
I have lost my iPhone 4S and would like to know how to block it so know one can use it, i've got the IMEI, but don't know how to block it?
-
IGPExecutionContext null in complete() method
I am running a GP/CO in GP runtime environment and not as a standalone Web dynpro . The execute method is successfully run and the this.executionContext var is populated. In the complete() method for some reason this variable(IGPExecutionContext inst
-
Hi I am writing a procedure where it takes collection as IN parameter and gets ref_cursor as OUT parameter i am able to write it without procedure in pl/sql block but not able to write in procedure. -created collection t_deptno_c and ref cursor is ke