Extract rows from table
I have the structure of the table as shown below:col1 col2
1 a
1 b
1 c
3B
4 a
3 a
1 b
2 c
Now I want to read all the lines where the value of col1 = '1' and once that the value of col2 corrosponding is identified, all the other values in col1 corrosponding should also be retrieved.
can someone help me please to get there?
Thanks in advance
Just put a SEPARATE to my above query then
SQL> with t as
2 (
3 select 1 col1,'a' col2 from dual
4 union all
5 select 1,'b' from dual
6 union all
7 select 1,'c' from dual
8 union all
9 select 3,'b' from dual
10 union all
11 select 4,'a' from dual
12 union all
13 select 3,'a' from dual
14 union all
15 select 1,'b' from dual
16 union all
17 select 2,'c' from dual
18 )
19 select distinct col1,col2
20 from t
21 where col2 in (select col2
22 from t
23 where col1 = 1)
24 order by col2
25 /
COL1 C
---------- -
1 a
3 a
4 a
1 b
3 b
1 c
2 c
7 rows selected.
Tags: Database
Similar Questions
-
Extracting data from table without refreshment and without using the tab key.
Hi friends,
I have a problem I want to extract data from table without discount in the text field without using the Tab key. When I enter a field value any value then the text corressponding should enter into corressponding textfield without using the Tab key.
for example. When I get back emp_id 101 in a text field then first_name and last_name, address would come in to the text fields corressponding without refresh and use the Tab key.
How can I do that.
Thank you
MauryHi Maury,
I guess it's similar to: retrieving data without refreshing rather than Re: value of a textfield should enter into an another textfield without using the TAB ?
If so, the only change you want to bring on the first is to use the parameter "Onkeyup" instead of "onchange" in the 'HTML Form attributes of the element' element.
Note, however, that the user must move away from the issue at some point (for example, to click on a button), so the onchange will fire anyway.
Andy
-
Script Insert statement to extract data from Table in Oracle 7i
Hi all, I have an old Oracle legacy system that works for more than 15 years. Every now and then, we need to extract data from this table @ ORacle 7i to import to Oracle 10 G.
My thoughts are to create a script to Insert statements in oracle 7 and that, to be deployed to Oracle 10 G.
I found cela scripts in Google and don't know exactly how it works. No explanation on these scripts, would be greatly appreciated. I find that this format can help to produce a set of insert statements in this table to the last table to 10G.
< pre >
-Step 1: create this procedure:
create or replace function ExtractData (v_table_name varchar2) return varchar2 as
Boolean b_found: = false;
v_tempa varchar2 (8000);
v_tempb varchar2 (8000);
v_tempc VARCHAR2 (255);
Start
for tab_rec in (select table_name from user_tables where table_name = upper (v_table_name))
loop
b_found: = true;
v_tempa: =' select ' insert into ' | tab_rec.table_name |' (';
for col_rec in (select * from user_tab_columns)
where
table_name = tab_rec.table_name
order by
column_id)
loop
If col_rec.column_id = 1 then
v_tempa: = v_tempa | " ' || Chr (10) | " ' ;
on the other
v_tempa: = v_tempa |', ". Chr (10) | " ' ;
v_tempb: = v_tempb |', ". Chr (10) | " ' ;
end if;
v_tempa: = v_tempa | col_rec.column_name;
If instr(col_rec.data_type,'CHAR') > 0 then
v_tempc: = "' |' | col_rec.column_name |'| " ' ;
elsif instr (col_rec.data_type, 'DATE') > 0 then
v_tempc: = "' to_date ("'| to_char('|| col_rec.column_name||',''mm/DD/YYYY HH24 '') | ") (', "' dd/mm/yyyy hh24"') "';
on the other
v_tempc: = col_rec.column_name;
end if;
v_tempb: = v_tempb | " ' || Decode('|| col_rec.column_name||',''Null'','||v_tempc||') | " ' ;
end loop;
v_tempa: = v_tempa |') values ('| v_tempb |'); "from ' |" tab_rec.table_name | « ; » ;
end loop;
If not b_found then
v_tempa: ='-Table ' | v_table_name | 'not found ';
on the other
v_tempa: = v_tempa | Chr (10) | "select"-commit; "double;';
end if;
Return v_tempa;
end;
/
display errors
-STEP 2: run the following code to extract the data.
Go head
set pages 0
game of stripes on
fixed lines 2000
the feeding off value
trigger the echo
var retline varchar2 (4000)
coil c:\t1.sql
Select 'set echo off' from dual;
Select 'spool c:\recreatedata.sql' from dual;
Select ' select "-these data was extracted on" | TO_CHAR (sysdate, "mm/dd/yyyy hh24" ") double;' double.
-The following two lines as repeat as many times as the tables that you want to extract
exec: retline: = ExtractData ('dept');
print: retline;
exec: retline: = ExtractData ('emp');
print: retline;
Select 'off spool' from dual;
spool off
@c:\t1
-Step 3: run the updated c:\recreatedata.sql waiting for output to recreate the data.
Source: http://www.idevelopment.info/data/Oracle/DBA_tips/PL_SQL/PLSQL_5.shtml
< / pre >Hello
Well what this script do.
You will pass a table name as input to the function that will return varchar2 (string - insert statement). It will generate 2 t1.sql of sql script that contains the output sequence.Will use the first passed the user_tables scipt to check if the input table name exists and if there is the will reterive user_table_columns column names and generate the following sql script.
Now, this t1.sql will run to generate a final sript formally orders insert that will run you on the target schema (make sure that the table exists).* #t1.sql*
set echo off spool recreatedata.sql select '-- This data was extracted on '||to_char(sysdate,'mm/dd/yyyy hh24:mi') from dual; select 'insert into MY_OBJECT1 ('||chr(10)||'OWNER,'||chr(10)||'TOTAL) values ('||decode(OWNER,Null,'Null',''''||OWNER||'''')||','||chr(10)||''||decode(TOTAL,Null,'Null',TOTAL)||');' from MY_OBJECT1; select '-- commit;' from dual; spool off
Then @t1.sql runs, and the general insert for the infeed table table.
-- This data was extracted on 03/09/2009 23:39 INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('MDSYS', 92800); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('TSMSYS', 256); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('DMSYS', 15104); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('TESTME', 128); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('PUBLIC', 2571392); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('OUTLN', 768); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('CTXSYS', 21888); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('OLAPSYS', 78336); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('KLONDIKE', 2432); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('SYSTEM', 51328); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('EXFSYS', 21504); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('DBSNMP', 4096); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('ORDSYS', 216192); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('SYSMAN', 111744); -- commit;
Hope this helps
Concerning -
Extracting data from table using the date condition
Hello
I have a table structure and data as below.
create table of production
(
IPC VARCHAR2 (200),
PRODUCTIONDATE VARCHAR2 (200),
QUANTITY VARCHAR2 (2000).
PRODUCTIONCODE VARCHAR2 (2000).
MOULDQUANTITY VARCHAR2 (2000));
Insert into production
values ('1111 ', '20121119', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121122', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121126', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121127', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121128', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121201', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20130103', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20130104', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20130105', ' 1023', 'AAB77',' 0002');
Now, here I want to extract the data with condition as
PRODUCTIONDATE > = the current week Monday
so I would skip only two first rows and will need to get all the lines.
I tried to use it under condition, but it would not give the data for the values of 2013.
TO_NUMBER (to_char (to_date (PRODUCTIONDATE, 'yyyymmdd'), 'IW')) > = to_number (to_char (sysdate, 'IW'))
Any help would be appreciated.
Thank you
MaheshHello
HM wrote:
by the way: it is generally a good idea to store date values in date columns.One of the many reasons why store date information in VARCHAR2 columns (especially VARCHAR2 (200)) is a bad idea, it's that the data invalid get there, causing errors. Avoid the conversion of columns like that at times, if possible:
SELECT * FROM production WHERE productiondate >= TO_CHAR ( TRUNC (SYSDATE, 'IW') , 'YYYYMMDD' ) ;
-
Extracting data from table.
Hello and happy Friday.
I'm reworking an instrument for an HP 662 X power driver. We have four in the lab and I want to have a panel that writes the channel information and reads what the instrument setting are. I have entries works fine, but I can't extract the data from the VI "read the voltage and current. What I would like is the opposite of "build the Subvi where I can get a table and the elements come they channel to the next available line. I have attached the control program which should give you a better understanding of what I'm trying to accomplish here. Any ideas will be greatly appreciated. The pilot, with that I started is one downloaded from NEITHER!
Thank you
Gary
Also: why the property for the resource node VISA? Use a thread.
Attached is a slight mod showing the use of a cluster instead of individual controls if you want to try it.
-
Hello
I'm trying to remove the lines that contain a multiple of the x-data in the original table and have the output array display the original array less table of harmonics of delete.
Original array:
3 100
18 200
13 300
8 400
500 0
600 0
700 0
Deletes rows that contain multiples of 300. Output array will be
3 100
18 200
8 400
500 0
700 0
Any help will be really appreciated.
Thank you
hiNi.
This?
-
ADF jsf: disabled property works on selecting rows from table but not rendered
I use JDeveloper 12.1.2
Page has 3 components:
-table
-button
-text outputFormatted component
When the user selects a certain line, button is enabled/disabled according to the logic of bean support. It works fine:
< af:button text = "Go to the reports!" id = "b1" action = "#{backingBeanScope.Studybrowse.b1_action} '"
Disabled = "#{! backingBeanScope.Studybrowse.userAuthStdNotExp} '"
partialTriggers = "t1" / >
However when I apply the same boolean rendered property of outputFormatted, it is not visible (not provided)
< af:outputFormatted value = "you are not authorized or study expired" id = "1".
rendered = "#{! backingBeanScope.Studybrowse.userAuthStdNotExp} '"
inlineStyle = "color: Red;" partialTriggers = "t1" / >
Someone knows why?
I just read on another post that partial triggers cannot work on a component that is not rendered. Therefore, it is suggested to use the "visible" property If it worked:
visible = "#{! backingBeanScope.Studybrowse.userAuthStdNotExp} '"
inlineStyle = "color: Red;" partialTriggers = "t1" / >
I'm sure that this rendered version worked in 10g, but
-
How to truncate 1000 rows from a table of 7000 lines?
Hello
Please give me a quick answer to truncate the 1000 rows from a table of 7000 lines... I don't want to truncate the entire table
Thank you all for the valuable support,
My activity is still ongoing... Somehow my client was not specific about what lines are deleted. It has no date column in the table to delete records by date...
The table contains information about the error logs, so he wanted to keep a few lines and remove the rest... and then copy the table to another database.
So right now using this query:
SQL > delete (select * from
) where rownum<> ; Once again thank you to all...
-
Extract data from the table on hourly basis
Hello
I have a table that has two columns date all the hours of the base and the response time. I want to extract data from the date corresponding previous hourly basis with the response time. The data will be loaded into the table every midnight.
for example: today date 23/10/2012
I want to extract data from 22/10/12 00 to the 22/10/12 23
The sub query pulls the date as demanded, but I'm not able to take the time to answer.
with one also
(select min (trunc (lhour)) as mindate, max (trunc (lhour)) as AVG_HR maxdate)
SELECT to_char (maxdate + (level/25), "dd/mm/yyyy hh24") as a LEVEL CONNECTION dates < = * (1) 24;
Please help me on this.Try this
SELECT * FROM table_nm WHERE to_char(hour,'DD') = to_char(SYSDATE-1,'DD')
-
wanted to extract data from nested table pl/sql Ref Cursor getting an erro
create or replace type 'DEPT12' as an object (dno number (2), dname varchar2 (30), varchar2 (50)) loc;
create or replace type dept_tab in the table in "DEPT12".
create or replace type 'LOC12' as an object (locno number, loc_name varchar2 (100))
create or replace type loc_tab in the table of "LOC12.
create or replace type dept_loc_rec1 as an object (dept_tab, eno number, loc_dt loc_tab dept_dt);
Create type dept_loc_tb as table of the dept_loc_rec1
create table dept_loc_tb_bk1 (dept_dt dept_tab, eno number, loc_dt loc_tab)
NESTED TABLE dept_dt
STORE AS dept_tab12,
NESTED TABLE loc_dt
STORE AS loc_tab12
insert into dept_loc_tb_bk1 values (dept_tab (dept12(3,'ABD','LOC')
dept12(4,'ABD','LOC')
(, dept12(5,'ABD','LOC')), 3, loc_tab (loc12(21,'AAB'),
loc12(22,'AAB'),
loc12(23,'AAB')));
When I try to extract data from Ref cursor to pl/sql table that I get an error ora-06504: pl/sql: return types of the result set of variables or request do not match.
I created a table nested, as well as the pl/sql nested table object dept_loc_tb and I said the same dept_loc_tb lv_dept_loc_tb, but trying to get in this variable we get an error above.
Please anyone can solve my problem.
-----------------
declare
type cr is ref cursor;
cr_obj cr;
lv_dept_loc_tb dept_loc_tb;
Start
Open cr_obj to select dept_dt, eno, dept_loc_tb_bk1 loc_dt;
collect the fetch cr_obj in bulk in lv_dept_loc_tb;
close cr_obj;
end;Your query selects 3 distinct columns requires so 3 collections of matching types. You want to treat these 3 columns as an object of type DEPT_LOC_REC1:
SQL> declare 2 type cr is ref cursor; 3 cr_obj cr; 4 5 lv_dept_loc_tb dept_loc_tb; 6 7 begin 8 open cr_obj for select dept_dt,eno,loc_dt from dept_loc_tb_bk1; 9 fetch cr_obj bulk collect into lv_dept_loc_tb; 10 close cr_obj; 11 end; 12 / declare * ERROR at line 1: ORA-06504: PL/SQL: Return types of Result Set variables or query do not match ORA-06512: at line 9 SQL> declare 2 type cr is ref cursor; 3 cr_obj cr; 4 5 lv_dept_loc_tb dept_loc_tb; 6 7 begin 8 open cr_obj for select DEPT_LOC_REC1(dept_dt,eno,loc_dt) from dept_loc_tb_bk1; 9 fetch cr_obj bulk collect into lv_dept_loc_tb; 10 close cr_obj; 11 end; 12 / PL/SQL procedure successfully completed. SQL>
SY.
P.S. discover sys_refcursor. -
extract data from a table to a text file
I need to extract data from a table to a text file, I twist my output is the following...
bash-3. $00 vi tap3roamercosts_20110915144318.txt
lines of 'tap3roamercosts_20110915144318.txt' 393948, 23464348 characters
^ LAFGTD | N | 2011090203000001 | 13242514000064 | 1. 0 | 20. 41220 | 02-SEVEN.-11. 01-SEPT.-11. 0 | 13244
755. 64. 70. 0093794428588 | 0093796234547 | 0 | S2 | E | 412200306902634 | 8. 1. 61500 | 16081 |
| HW | Call to the Roamer. 0 | I have | Roaming billing Inroamer Plan | 1_0_1 | LKA | N_I_Independent
the time of day. Rate of Roamer SMST systems | AFGTD20110902030000010001013242514000064 |
|||||||||||||||||||||
AFGTD | N | 2011090203000001 | 13242612000044 | 1. 0 | 20. 41220 | 02-SEVEN.-11. 01-SEPT.-11. 0 | 13244
853. 44. 70. 234. 0093793252818 | 0 | S2 | E | 412200303198150 | 8. 1. 61000 | 12403 | HW | -Ro
bitter call | 0 | I have | Roaming billing Inroamer Plan | 1_0_1 | N_I_Independent time of Da
There | Rate of Roamer SMST systems | AFGTD20110902030000010001013242612000044 |
||||||||
AFGTD | N | 2011090203000001 | 13242612000047 | 1. 0 | 20. 41220 | 02-SEVEN.-11. 01-SEPT.-11. 0 | 13244
853. 47. 70. 234. 0093793252818 | 0 | S2 | E | 412200303198150 | 8. 1. 61000 | 12403 | HW | -Ro
bitter call | 0 | I have | Roaming billing Inroamer Plan | 1_0_1 | N_I_Independent time of Da
There | Rate of Roamer SMST systems | AFGTD20110902030000010001013242612000047 |
||||||||
.
.
.
.
.
Please help me how to format my output each record in simple lines in oracle sqlplus. Here are the settings I used...
TERMOUT OFF SET;
SET ECHO OFF;
SET LINESIZE 100000;
THE VALUE OF NEWPAGE 0;
SET SPACE 0;
SET PAGESIZE 50000;
SET FEEDBACK OFF;
SET THE OFF POSITION;
SET TRIMSPOOL
SET THE TABAnd what was wrong with the answers that you have on your previous thread?
How to extract data in a text file
Please do not ask the same question again. If there is a problem with the answers provided, then continue on the same thread that tell people what is the problem.
Saying that, this is another possibility for you...
As user sys:
CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles' / GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser /
As myuser:
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2 ,p_dir IN VARCHAR2 ,p_header_file IN VARCHAR2 ,p_data_file IN VARCHAR2 := NULL) IS v_finaltxt VARCHAR2(4000); v_v_val VARCHAR2(4000); v_n_val NUMBER; v_d_val DATE; v_ret NUMBER; c NUMBER; d NUMBER; col_cnt INTEGER; f BOOLEAN; rec_tab DBMS_SQL.DESC_TAB; col_num NUMBER; v_fh UTL_FILE.FILE_TYPE; v_samefile BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file); BEGIN c := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE); d := DBMS_SQL.EXECUTE(c); DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab); FOR j in 1..col_cnt LOOP CASE rec_tab(j).col_type WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val); WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val); ELSE DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); END CASE; END LOOP; -- This part outputs the HEADER v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767); FOR j in 1..col_cnt LOOP v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),','); END LOOP; -- DBMS_OUTPUT.PUT_LINE(v_finaltxt); UTL_FILE.PUT_LINE(v_fh, v_finaltxt); IF NOT v_samefile THEN UTL_FILE.FCLOSE(v_fh); END IF; -- -- This part outputs the DATA IF NOT v_samefile THEN v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767); END IF; LOOP v_ret := DBMS_SQL.FETCH_ROWS(c); EXIT WHEN v_ret = 0; v_finaltxt := NULL; FOR j in 1..col_cnt LOOP CASE rec_tab(j).col_type WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val); v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',','); WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val); v_finaltxt := ltrim(v_finaltxt||','||v_n_val,','); WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val); v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),','); ELSE v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',','); END CASE; END LOOP; -- DBMS_OUTPUT.PUT_LINE(v_finaltxt); UTL_FILE.PUT_LINE(v_fh, v_finaltxt); END LOOP; UTL_FILE.FCLOSE(v_fh); DBMS_SQL.CLOSE_CURSOR(c); END;
This allows the header line and the data to write into files separate if necessary.
for example
SQL> exec run_query('select * from emp','TEST_DIR','output.txt'); PL/SQL procedure successfully completed.
Output.txt file contains:
empno,ename,job,mgr,hiredate,sal,comm,deptno 7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20 7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30 7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30 7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20 7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30 7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30 7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10 7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20 7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10 7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30 7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20 7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30 7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20 7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10
The procedure allows for the header and the data to separate files if necessary. Just by specifying the file name "header" will put the header and the data in a single file.
Adapt to the exit of styles and different types of data are needed.
-
How NOT to restrict no rows from two tables
I have two identical paintings invoice and payment. The only difference is Invoice_id Payment_id, Invoice_Amt and Payment_Amt columns displaying the amounts and different IDS. Bank_ids, names, account_types are the same. Table Invoice has 3 rows and payment 2. Just, which means that there are 3 generated invoices, but the Bank has received 2 payments. I want to show Invoice_Amt and Payment_Amt using the sql query. But its gives me total 6 rows. Whereas, I want 3 of the invoice and 2 rows of table of payment to show by-side.
CREATE TABLE Bill
(invoice_id NUMBER
bank_id NUMBER,
bank_name VARCHAR2 (256),
invoice_amount NUMBER);
/
-Invoice table has 3 lines showing 3 invoice AMT
Payment of CREATE TABLE
(payment_id NUMBER
bank_id NUMBER,
bank_name VARCHAR2 (256),
Payment_amount NUMBER);
/
-Payment table has 2 lines showing 2 payments
After executing this statement sql below, I get 6 rows:
Select inv.invoice_amount, pymt.payment_amount in the invoice inv, dated payment where inv.bank_id = pymt.bank_id;
How can I show 3 rows for the invoice and 2 payment... ?
Thank you.select inv.invoice_amount, pymt.payment_amount from ( select invoice_amount, bank_id, row_number() over(partition by bank_id order by invoice_id) rn from invoice ) inv FULL OUTER JOIN ( select payment_amount, bank_id, row_number() over(partition by bank_id order by payment_id) rn from payment ) pymt ON (inv.bank_id = pymt.bank_id and inv.rn = pymt.rn) /
SY.
-
Using a substitution variable to extract data from a table
Hello
I work with a simple program that asks the user to enter any information which will focus on a table in the DB.
So far, I read 1 000 ways to accomplish this, and none of them work.
PROMPT ACCEPT var PROMPT 'Enter var' DECLARE ........ BEGIN SELECT &var FROM &table WHERE var=tablevar; ......... END;
Hello!
You have a lot of mistakes in your code.
I did something similarly...SQL> SQL> SQL> set serveroutput on SQL> DECLARE 2 p_no number := &p_no; 3 v_planet starbright.planet%type; 4 BEGIN 5 6 -- INSERT p_no 7 -- INTO starbright; 8 SELECT planet 9 INTO v_planet 10 FROM starbright 11 WHERE planet_num = p_no; 12 13 dbms_output.put_line( 'Result: ' || v_planet ); 14 END; 15 / Enter value for p_no: 367 old 2: p_no number := &p_no; new 2: p_no number := 367; Result: Venus PL/SQL procedure successfully completed. SQL>
T
-
Hello
Here, I want to extract data from the XY graph. I joined vi which I use for table 1 d. How can I use this for 2D table VI.
Thank you
Hi Alex,
You can use the same approach.
The only thing that changes is the function ArraySubset in its adaptation to the 2D matrix. You can select rows or clumns of your data (depending on how you have generated them)...
-
extract data from XMLType using vbscript on OleDB?
Hello.
We have a problem where the XMLType column data to get in 11.2.0.1 on Windows x 64 worked very well, but we have moved to 11.2.0.3 Patch 21 and the column type changed to binary storage default, and we started to do read errors when the data was greater than 32 k (or so it seems).
I opened a SR, and Oracle support sent me a VB script to test playback of the table on OleDB. However, their script doesn't seem to work as announced, so after a lot of gooling, came to us with the following to read a column of xmltype - not the same table, just to test that the vbscript works:
REM need to re-register the dll OLEDB as there is a problem with the oracle client and the dll registration
REM start following an administrator command prompt
REM regsvr32.exe c:\Users\finite9\oracle\product\11.2.0\client_2\bin\oraoledb11.dll
the con value = createobject ("adodb.connection")
con. Open "provider = oraoledb.oracle; user id = finite9; password = password1; data source = TSTDB ".
Set rs = createobject ("adodb.recordset")
RS. Open 'select SW_REPLY changedate', con
While not on the place. EXPRESSIONS OF FOLKLORE
MsgBox rs. Fields ("ChangeDate"). Value
RS. MoveNext
Wend
RS. Close
Set rs = nothing
con. Close
the value con = nothing
This works perfectly and displays 12 rows in this column in a vbscript dialog box, but I am not able to do to extract the XMLType column clob data. I try with for example. RS. Open 'select REPLYDATA.getclobval () from SW_REPLY', stupid but just get errors.
Is it possible to extract data from XMLType on OleDB with vbscript? It cannot be OleDB itself which poses problem, because it has worked in our application and 11.2.0.1 although with < 32 k of data. But it would be nice to have a working test case while we were able to test out our app. If it is with vbscript or c# is irrelevant.
ignore the message, it is possible. Support of Oracle gave me this:
the con value = createobject ("adodb.connection")
con. Open "provider = oraoledb.oracle; user id = finite9; password = password1; data source = DEVTST ".
Set rs = createobject ("adodb.recordset")
RS. Open "select t.REPLYDATA.getclobval () as xmltestdata OF SW_REPLY t", con
While not on the place. EXPRESSIONS OF FOLKLORE
MsgBox rs. Fields ("xmltestdata"). Value
RS. MoveNext
Wend
RS. Close
Set rs = nothing
con. Close
the value con = nothing
but there is a problem when xmldata exceeds a certain size. small starters work well if.
Maybe you are looking for
-
Is there an automatic procedure to retrieve all the drivers on the Satellite U200?
I have re-installed XP on my Satellite U200 and lost all drivers and settings. Is there an automatic procedure to retrieve all the? I'm a bit mazed by 52 varieties of the drivers available on the support web site. Thank you. Alexey.
-
Hello Now, I build a Canopen GUI, which should be able to check the heartbeat of 50 devices. But it seems that I have to build 50 parallel loops to do this. If I want to do series, can it take too much time for the verification of all devices. If som
-
new printer deskjet 3511 will not install the full version
I just bought a new printer a deskjet 3511. I tried for 2 days to get a full installation. I had hp technology works with me all night. I did a full restore. It will not install stll. It downloads that fundamental. I checked my control panel and it d
-
LaserJet M1213nf MFP: Printer does not print the claim code more
I use a chromebook, so I use my printer as a Google Cloudprinter. Usually, I'm able to get my printer using claim code that is printed in the Backgrounder (this information sheet is printer when I activate HP Webservices on the printer). For some rea
-
Currently, android player is missing from the feature of running native code, because there is no support for arm v7le. If anyone can help on porting/add support for arm v7le in android ndk toolchain?