How to duplicate a row by a number field
Hi to all,
I've a query like this:
SELECT * FROM
(SELECT 'text1' field, 4 num FROM dual
UNION ALL
SELECT 'text2' field, 2 num FROM dual)
I want to read N records like the number in the "num" field.
My result could be this:
SELECT 'text1' field, 4 num FROM dual
UNION ALL
SELECT 'text1' field, 4 num FROM dual
UNION ALL
SELECT 'text1' field, 4 num FROM dual
UNION ALL
SELECT 'text1' field, 4 num FROM dual
UNION ALL
SELECT 'text2' field, 2 num FROM dual
UNION ALL
SELECT 'text2' field, 2 num FROM dual
Can I duplicate a row by a number field ?
Like this
with t
as
SELECT 'text1' field, 4 num FROM dual
UNION ALL
SELECT 'text2' field, 2 num FROM dual
select t.*
from t
cross join
select level no from dual connect by level <= (select max(num) from t)
where num >= no
order by 1
Similar Messages
-
How to retrieve one row from the number of records in a table
i want to retrieve the rows from the number of records in a table without using the perticular column name.
select count(*) from table
/If you have your table currently analyzed, and no changes have been made, then you could
select num_rows from user_tables where table_name = 'table' -
Duplicate whole row, change account number
Hi, I would like to duplicate the whole row in Journal Entry and then change the account number. However, when I changed the account number, the content of the other fields was cleared. i,e. All duplicated contents were cleared.
Is there any way to configure so that the content of duplicated row were not cleared when I change the account number?
Thanks.
Raymondhi raymond,
On duplicating row changing account code will
clear amount in debit/credit as this is normal system behaviour
even when you are raising service documents.
Are you doing single journal entry/mass JE?
Jeyakanthan -
How to display a row after a subtotal field in ALV Grid
Hi All,
My requirement is to print a extra row with values and constant text after printing subtotal values in ALV Grid.
e.g. TOTAL 12.23 ---> Subtotal field
Tax 5.2 ---> extra row after subtotal field.
Please help me....
Thanks in advance.
Regards
AjayHi
You can try using INSERT <WA> OR INSERT INITIAL LINE .
fill the wa with tax value.
INSERT <wa> into table < internal table >
A row will be inserted into internal table with the values.
Try this and let me know.
Thanks
Hariharan -
Service Tax Registration Number field not found in FD01 under CIN Details
Hi Experts,
I am using R3 - ECC5
T Code - FK01 / FK02 / FK03.
Can you guys tell me
1. I am not able to view the field "Service Tax Registration Number" under the "Sales Tax Tab" in customer master. Can you tell me how to populate the "Service Tax registration number" field under - Customer Master - Additional details - CIN Details - SalesTax.
2. Also in one System the above Tab name is "Sales Tax/Service Tax" where I am able to also view the "Service Tax Registration Number" field. But in the R3 System where I am not able to view the "Service Tax Registration Number" Field the Tab name is just "Sales Tax". Can you tell me how to change this Tab Name to "Sales Tax / Service Tax".
Rgds
PrasadHi Experts,
I am using R3 - ECC5
T Code - FK01 / FK02 / FK03.
Can you guys tell me
1. I am not able to view the field "Service Tax Registration Number" under the "Sales Tax Tab" in customer master. Can you tell me how to populate the "Service Tax registration number" field under - Customer Master - Additional details - CIN Details - SalesTax.
2. Also in one System the above Tab name is "Sales Tax/Service Tax" where I am able to also view the "Service Tax Registration Number" field. But in the R3 System where I am not able to view the "Service Tax Registration Number" Field the Tab name is just "Sales Tax". Can you tell me how to change this Tab Name to "Sales Tax / Service Tax".
Hi Problem has not been resolved. Can anyone give some solution.
Rgds
Prasad -
How can i duplicate a row in numbers
How do you duplicate a row in numbers?
Hi Rusty,
I worry that this may be a trick question, but here goes:
Click on the Row tab to select the entire row.
Command-C to Copy the Row to the Clipboard
Insert > Copied Rows
Or, did you have something else in mind?
Jerry -
How to add blank rows between groups of duplicate rows?
here is my setup
create table #tmpA(rowID int identity(1,1), fName varchar(10), lName varchar(10))
insert into #tmpA
select 'a', 'b' union all
select 'a', 'b' union all
select 'c', 'd' union all
select 'c', 'd' union all
select 'e', 'f' union all
select 'e', 'f' union all
select 'g', 'h' union all
select 'g', 'h'
select distinct fName, lName
into #tmpB
From #tmpA
select t1.* from #tmpA t1 Join #tmpB t2 on t1.fName = t2.fName and t1.lName = t2.lName
--output
rowID fName lName
1 a b
2 a b
3 c d
4 c d
5 e f
6 e f
7 g h
8 g h
I want to add blank rows between rows 2 & 3 and between rows 4 & 5 and between rows 6 & 7 in the join query above. Is there Tsql that can accomplish something like this to make the join query result look like the following output?
rowID fName lName
1 a b
2 a b
3 c d
4 c d
5 e f
6 e f
7 g h
8 g h
or if this is not possible I could go with an output like this:
rowID fName lName
1 a b
2 a b
3
4 c d
5 c d
6
7 e f
8 e f
9
10 g h
11 g h
Rich PI came up with the following on my own. I was just hoping there might be a fancier way to do this - like without looping -- and yes, I could/should do this in a presentation layer, but I just wanted to do this in Query Analyzer (or whatever they call
it now -- SSMS ...) -- BTW, thanks CELKO for the suggestion about how to insert multiple rows using Values -- works great.
If (object_id('tempdb..#tmpA') is not null) drop table #tmpA
If (object_id('tempdb..#tmpC') is not null) drop table #tmpC
create table #tmpA(rowID int identity(1,1), fName varchar(10), lName varchar(10))
insert into #tmpA
values
('a','b'),
('a','b'),
('c','d'),
('c','d'),
('e','f'),
('e','f'),
('g','h'),
('g','h')
create table #tmpC(rrowID int Identity(1,1), rowID int, fName varchar(10), lName varchar(10))
declare @i int, @s varchar(10), @t varchar(10), @u varchar(10), @v varchar(10)
select @i = min(rowID) from #tmpA
set @u = 'xx'
While (@u != 'yy')
Begin
select @s = fName, @t = lName from #tmpA Where rowID = @i
if exists(select 1 from #tmpA Where rowID = @i + 1)
select @u = fname, @v = lName From #tmpA Where rowID = @i + 1
else
set @u = 'yy'
if @s = @u And @t = @v
begin
Insert Into #tmpC(rowID, fName, lName) Select * from #tmpA Where rowID = @i
Insert Into #tmpC(rowID, fName, lName) Select * from #tmpA Where rowID = @i + 1
end
else
begin
Insert Into #tmpC(rowID, fName, lName) Select null, '', ''
end
set @i = @i + 1
End
select * from #tmpC
--output from #tmpC
rrowID rowID fName lName
1 1 a b
2 2 a b
3 NULL
4 3 c d
5 4 c d
6 NULL
7 5 e f
8 6 e f
9 NULL
10 7 g h
11 8 g h
12 NULL
Rich P -
How can i add rows in a tabular form
Hi,
How can i add rows in a tabular form with out updating in database and after adding the rows one by one and after filling the data then iwant to submit them all at once.Please help me on this.
ThanksHello Leandro,
In the Add_Rows page process, there is a box for "Number Of Rows". Change that value and you change the number of rows that get added. The default is 1.
Don.
You can reward this reply by marking it as either Helpful or Correct :) -
how to insert a row in oracle if we have three colums all are number datatype i want one of the column blank;
Hi,
James has replied to your question ..
you seem to be new to sql
just adding to it for you information.. that in this case col2 will have NULL value.
I suggest you may please read the startup docs... They shall help you to unserdstand the sql better.
http://www.w3schools.com/sql/default.asp
Regards -
How to create a table with varied number of columns?
I am trying to create a balance table. The colunms should include years between the start year and end year the user will input at run time. The rows will be the customers with outstanding balance in those years.
If the user input years 2000 and 2002, the table should have columns 2000, 2001, 2002. But if the user input 2000 and 2001, the table will only have columns 2000 and 2001.
Can I do it? How? Thanka a lot.Why did you create a new thread for this?
How to create a table with varied number of columns? -
How to capture the row value in Advanced Table on OAF ?
Hi:
I was wondering, if anyone has any idea as to how to capture a row value on an advanced table on a OAF Page.
I am currently trying to capture the Expense Report Number ( first column) on the Track Expenses Reports table on the page /oracle/apps/ap/oie/webui/HomePG.
Any idea would be helpful ?
Thank YouHi,
856070 wrote:
This is what I am looking for :
Default Functionality
On the expenses home page there is a table for the Submitted expenses Table ( advanced table) with multiple Expense Number rows , which has a link associated with every expense number. When the user clicks the expense number link , EBS takes you to a more detail information page. ---As per default functionality :::whene ever user clicks on link it will takes u to details info page based expense no right.
---Check the property of the Destination URL of the ExpensionNumber column.
---In this property u can find the page path and paramam ex:pexpencenumber.
Customized functionality
I would like to capture the Expense number on the detailed page to call another application based on the expense number. The expense number on the
detailed page is not available on the request-parameter or on the VO.
I was thinking of capturing the ExpenseNumber when the user clicks it and save the expense number on a >transientvalue to retrieve it on the detaile dpage..but unable to do so.---Here get the paramereter pexpencenumber and pass it to another appilcation.
Regards
Meher Irk -
Displaying the Row and Column number in the report
I am trying to show row and column number in the report (not just web preview). I am using Hyperion Reports Version 7.2.5.168
use a formula column/row. use RANK function in that. (e.g. Rank([A], asc) will sort the rows based on column A values in ascending order)
you can use this rank in your heading.
But frankly this is not so easy. You have to do it in a very intelligent way, so that rank gives you column number/row number any how.
Have a try and let see if you find a appropriate solution.
Regards,
Rahul -
We have been seeing the following 'warnings' in the event log of our BizTalk machine since upgrading to BTS 2006. They seem to occur randomly 6 or 8 times per day.
Does anyone know what this means and what needs to be done to clear it up? we have only one BizTalk server which is running on only one machine.
I am new to BizTalk, so I am unable to find how many tracking host instances running for BizTalk server. Also, can you please let me know that we can configure only one instance for one server/machine?
Source: BAM EventBus Service
Event: 5
Warning Details: Execute batch error. Exception information: TDDS failed to batch execution of streams. SQLServer: bizprod, Database: BizTalkDTADb.Cannot insert duplicate key row in object 'dta_MessageFieldValues'
with unique index 'IX_MessageFieldValues'. The statement has been terminated..Other than ensuring that there exists a separate and single tracking host instance, you're getting an error about duplicate keys.. which implies that you're trying to Create a BAM Activity twice with the same data.
I suggest you have a in-depth examination of the BAM (TPE or API) associated with the orchestration. In TPE ensure that the first binding you select is the "Instance Id" or "Message Id" before going ahead to map the ports or others.
Regards. -
How to identify migrated rows on a table
Hi, folks,
I'm wondering how to identify migrated rows on a table.
I understand that ANALYZE generates data into CHAINED_ROWS. The Oracle document implies that this table has both CHAINED ROWS and MIGRATED ROWS. FYI:
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14231/general.htm#sthref1881
But how can I tell migrated rows from chained rows.
Thanks!
Alexim also not looking to ExporttoExcel feature on ADF just copy all the records displayed on a table
im also not looking to ExporttoExcel feature on ADF just copy all the records displayed on a table ,
Hi you can set the property( exportedRows) of exportListener
you can limit the number of rows to download
chekout documentaion
ADF RichClient API - af:exportCollectionActionListener -
How to compare two rows in PL/SQL?
Hi All,
How to compare two rows in PL/SQL? Is there any method that I can use instead of comparing them column by column?
Any feedback would be highly appreciated.PhoenixBai wrote:
Hi All,
How to compare two rows in PL/SQL? Is there any method that I can use instead of comparing them column by column?What "rows" are you referring to?
If you're talking of rows within a PL/SQL associative array there are techniques as described in the documentation... e.g.
SQL> ed
Wrote file afiedt.buf
1 declare
2 type v1 is table of number;
3 r1 v1 := v1(1,2,4);
4 r2 v1 := v1(1,2,3);
5 begin
6 if r1 MULTISET EXCEPT DISTINCT r2 = v1() then
7 dbms_output.put_line('Same');
8 else
9 dbms_output.put_line('Different');
10 end if;
11* end;
SQL> /
Different
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1 declare
2 type v1 is table of number;
3 r1 v1 := v1(1,2,3);
4 r2 v1 := v1(1,2,3);
5 begin
6 if r1 MULTISET EXCEPT DISTINCT r2 = v1() then
7 dbms_output.put_line('Same');
8 else
9 dbms_output.put_line('Different');
10 end if;
11* end;
SQL> /
Same
PL/SQL procedure successfully completed.
SQL>If you're talking about rows on a table then you can use the MINUS set operator to find the rows that differ between two sets of data...
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20-FEB-1981 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02-APR-1981 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-1981 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-1981 00:00:00 2850 30
7782 CLARK MANAGER 7839 09-JUN-1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19-APR-1987 00:00:00 3000 20
7839 KING PRESIDENT 17-NOV-1981 00:00:00 5000 10
7844 TURNER SALESMAN 7698 08-SEP-1981 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-1987 00:00:00 1100 20
7900 JAMES CLERK 7698 03-DEC-1981 00:00:00 950 30
7902 FORD ANALYST 7566 03-DEC-1981 00:00:00 3000 20
7934 MILLER CLERK 7782 23-JAN-1982 00:00:00 1300 10
14 rows selected.
SQL> select * from emp2;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7521 WARD SALESMAN 7698 22-FEB-1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02-APR-1981 00:00:00 2975 20
7782 CLARK MANAGER 7839 09-JUN-1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19-APR-1987 00:00:00 3000 20
7839 KING PRESIDENT 17-NOV-1981 00:00:00 5000 10
7900 JAMES CLERK 7698 03-DEC-1981 00:00:00 950 30
7934 MILLER CLERK 7782 23-JAN-1982 00:00:00 1300 10
7 rows selected.
SQL> select * from emp
2 minus
3 select * from emp2;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20-FEB-1981 00:00:00 1600 300 30
7654 MARTIN SALESMAN 7698 28-SEP-1981 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-1981 00:00:00 2850 30
7844 TURNER SALESMAN 7698 08-SEP-1981 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-1987 00:00:00 1100 20
7902 FORD ANALYST 7566 03-DEC-1981 00:00:00 3000 20
7 rows selected.If you actually need to know what columns data is different on "non-matching" rows (based on your primary key) then you'll have to compare column by column.
Maybe you are looking for
-
Blocked plug ins... how to unblock?
I just updated software on my MacBook and now I can't seem to get video ... I get a message/icon that says 'blocked plug ins' and link to down load Flash, which I have done. Doesn't seem to make it work. Any guidance is appreciated.
-
WWI report - getting generated report fields values
Anyone know which function module decomposes the fields values of a WWI report in preparation for printing. These values are stored in an internal table and used by print FM CVEA_RSDOS_CREATE_BY_EHS
-
Required actions to reflect changes made in xRPM 4.0 and 4.5 IMG to the UI
Hi Experts, Custom fields added in standard table, Our Functional consultant done SPRO configuration and added these fields in UI. After restarting J2EE engine also the new UI elements are not displaying in portal. Can you please guide me what is the
-
J2ee1.4 on RedHat 7.3
Could anyone please explain: Using /tmp as temporary directory... Searching for Java(TM) 2 Platform, Standard Edition... Initializing InstallShield Wizard... Exception in thread "main" java.lang.NoClassDefFoundError: J2EE which is the same problem, t
-
Ipad2 home button doesn't work
I bought an ipad2 32G in the apple online store. I got it one month ago. the home button began to have some problem maybe 2weeks ago. and today....it finally ..completely..Failure!! what can I do now..Help!!