Query for displaying columns in reverse order ?
Hi All,
I want to select/display all the columns of a table in reverse order. The no. of columns is arbitrary.
Can anyone please help me on this.\
Regards
-AKJ
apart from the physical data store implementation,
are columns actually guaranteed ordering ? Guaranteed.... probably not, but they are in the data dictionary in the order in which they are created, so are known to be consistent in that respect.
I don't think it's correct to refer to C(1)...C(n) ,
they are just columns, there's no particular reason
why one should come first or lastLikewise, I don't see the point in selecting columns out in a particular order unless you're trying to spool the output to a file.
Similar Messages
-
How to display Columns in Alphabatical order when using DESC command
Hello
A table column is inserted not in alphabetic order during the table creation definition.
So while describing the table definition (e.g. desc emp)
it will not show in the same order as we are written during the table creation.
Question: is there any utility/command/query which will display the columns in alphabatical order while describing it.
Regards
Nikhil Waniselect column_name from user_tab_columns
order by column_name;
should do it.
Sunil -
Need help with query for converting columns to rows
Hello,
I know this is a very common question asked in the forum. I have searched regading this, i did find some threads, but i was not able to achieve what i require from the answers posted. So anybody please help me.
I have a table which is having multiple columns as follows:
Insert into table_1 (X,Y,Z,A,B,C,D,E,F,G,H,I) values (0,0,2,0,0,1,3,0,0,0,0,0);I want to convert the result into a two column, multiple rows i.e., I want the result as follows:
Col1 Col2
X 0
Y 0
Z 2
A 0
B 0
C 1
D 3
E 0
F 0
G 0
H 0
I 0Please anybody help me in writing the query for this..Is this what you are expecting:
SQL> WITH T AS
2 (
3 SELECT 0 X, 0 Y, 2 Z, 0 A, 0 B, 1 C, 3 D, 0 E, 0 F, 0 G, 0 H, 0 I FROM DUAL
4 )
5 SELECT 'X' col1, X col2 FROM T
6 UNION ALL
7 SELECT 'Y' col1, Y col2 FROM T
8 UNION ALL
9 SELECT 'Z' col1, Z col2 FROM T
10 UNION ALL
11 SELECT 'A' col1, A col2 FROM T
12 UNION ALL
13 SELECT 'B' col1, B col2 FROM T
14 UNION ALL
15 SELECT 'C' col1, C col2 FROM T
16 UNION ALL
17 SELECT 'D' col1, D col2 FROM T
18 UNION ALL
19 SELECT 'E' col1, E col2 FROM T
20 UNION ALL
21 SELECT 'F' col1, F col2 FROM T
22 UNION ALL
23 SELECT 'G' col1, G col2 FROM T
24 UNION ALL
25 SELECT 'H' col1, H col2 FROM T
26 UNION ALL
27 SELECT 'I' col1, I col2 FROM T
28 /
C COL2
X 0
Y 0
Z 2
A 0
B 0
C 1
D 3
E 0
F 0
G 0
H 0
C COL2
I 0
12 rows selected. -
Query for releasing and closing Production order ststus in bulk
Hi
Releasing planed to released
1. i want to release all those production orders entered in system which are in planned status.I want to apply one query for that which should change the status of Prod orders to release in systems automatically by applying this query.Please give me that suitable query and how to use it for proper result.
closing released to planned
2. Same like above i want to close all those Production orders whose receipt quantity is equal to planned quantity. i.e i want one query which should change the status of production order from release to closed on condition that receipt quantity is equal to the planned quantity.Please give me that suitable query and how to use it for proper result.
ThanksFor point 1 and 2: It should not be tried and using a Query does not comply with SAP Support policy. Doing so would lead you to lose SAP Support.
-
Formatted search query for displaying invoice items details
hi all,
i need to display all the items in AP invoice.kindly suggest me a query for that.
in AP invoice
Ex. row items
code--descqtyprice--
total
I0001--XXXXXXX5--
100 -
500
query should display this row as
code--desc--
price
I0001--XXXXXXX--
100
I0001--XXXXXXX--
100
I0001--XXXXXXX--
100
I0001--XXXXXXX--
100
I0001--XXXXXXX--
100
=================================
the query should display as the qty is 5 so it will display the same item 5 times
kindly suggest me some query for formatted search
its very urgent
regards
sandipHi Sandip,
DoQuery("Select b.ItemCode from OINV a,INV1 b Where a.DocEntry=b.DocEntry")
Hope its help for you
Give me reward points,
Regards,
G.Suresh. -
Query for Identifying column changes
Hi Guys,
Need help in getting a query for my scenario.
I have 2 table Table A and Table B. Both have same columns and data type.
Table A:
Id PersonId Name Code Date
1 1000 John M 2014-07-28
2 1001 Mary B 2014-07-28
3 1002 Robin R 2014-07-28
4 1003 Maxie N 2014-07-28
Table B:
Id PersonId Name Code Date
1 1000 John 2014-07-28
2 1001 Hary S 2014-07-28
3 1002 Justin Q 2012-07-28
4 1003 Maxie P 2013-07-28
My situation is:
I need to compare both the tables and need to identify the rows that has a change in all columns, if all other columns are not changed and Code is changed to blank, i need to ignore that row.
The expected outcome is:
Id PersonId Name Code Date
2 1001 Hary S 2014-07-28
3 1002 Justin Q 2012-07-28
4 1003 Maxie P 2013-07-28
Thanks Guys...I found the solution in a easy way i guess...
select * from
SELECT ID, PERSONID,NAME,
case when code is null then
select a.code from tablea A where A.ID = B.ID
else
a.code
end as Code,
DATE FROM TABLE B
MINUS
SELECT ID,PERSONID,NAME,CODE,DATE FROM TABLE A
What do you guys think...would it work for my scenario....
i am testing few scenarios looks like working....... -
Performance of update query for single column vs multiple column
Hi All,
I could not find any answer for this, does it ever matter in terms of performance updating single column versus multiple column in a single update query.
For eg. table consisting of 15 columns, what would be the difference in performance when one column is update in the single query against another update query where 15 columns are updated.
Please do keep in mind my table columns in actually could be around 150+.
Thanks for any information provided.If updated columns aren´t on where clause , then the only impact of 15 columns will be a increase on redo generation, and a possible chainning row.
So since the redo is one of the things that have a large impact, the answer is yes.
The performance will be slower.
Regards
Helio Dias.
http://heliodias.com
OCE SQL, OCP 9i -
Update query for XMLTYPE column
Hello everyone,
I have inserted xml data into XMLTYPE column of my table,xml data is something like this
<Data type="FYI">
<ID xmlns="http://orcl.com">T-1-1</ID>
<Category>FRAME</Category>
<ProductID>1</ProductID>
<Name xmlns="http://orcl.com">Frame </Name>
<Type>BASIC</Type>
<Code>INSTALL</Code>
<NodeID>1</NodeID>
</Data>
Now i need to update the values inside the <Data> element,like
ID == T-2-2
Category == IFRAME
ProductID == 1.1
Name == IFRAME
We are using oracle 10g R2.
Please help me out how to update. It would be very thankfull for your valuble suggestions
Thanks in advance<Services>
<DataService type="FRLY">
<ID xmlns="http://www.openapplications.org/oagis/9">T-1-1-FRLY</ID>
<CategoryCode>FRAME</CategoryCode>
<ProductOfferingID>1</ProductOfferingID>
<Name xmlns="http://www.openapplications.org/oagis/9">Frame Relay</Name>
<SubType>FRLY - BASIC</SubType>
<ActionCode>INSTALL</ActionCode>
<NodeID>1</NodeID>
<Contract>
<ID xmlns="http://www.openapplications.org/oagis/9" schemeName="Networx Universal">00000</ID>
<Category name="Contract Type">U</Category>
</Contract>
<Contract>
<Type xmlns="http://www.openapplications.org/oagis/9">Routine</Type>
</Contract>
<CustomerParty>
<Location/>
</CustomerParty>
<ProvisioningStatus type="BillingSetup">
<Description xmlns="http://www.openapplications.org/oagis/9">C</Description>
</ProvisioningStatus>
<MileStone>
<ID xmlns="http://www.openapplications.org/oagis/9">CWD</ID>
<Date>2007-01-29</Date>
</MileStone>
<ActivityStatus>
<Code xmlns="http://www.openapplications.org/oagis/9" name="DueDate"/>
<EffectiveDateTime xmlns="http://www.openapplications.org/oagis/9">2007-01-29T00:00:00Z</EffectiveDateTime>
</ActivityStatus>
<AssociatedIDs>
<ID xmlns="http://www.openapplications.org/oagis/9">1</ID>
</AssociatedIDs>
<AssociatedIDs>
<TemporaryID schemeName="OPKEY">34908</TemporaryID>
</AssociatedIDs>
<Location>
<ID xmlns="http://www.openapplications.org/oagis/9">T-510092</ID>
</Location>
<OrderID>RequestID</OrderID>
<Accessory>
<ActionCode>ADD</ActionCode>
<Description xmlns="http://www.openapplications.org/oagis/9">IBM ESERVER-XSERIES306</Description>
<CategoryCode>5</CategoryCode>
<InstallVendorParty>
<Name xmlns="http://www.openapplications.org/oagis/9">MCI</Name>
</InstallVendorParty>
</Accessory>
<Circuit>
<ID xmlns="http://www.openapplications.org/oagis/9">T-1-1-FRLY</ID>
<AssociatedIDs/>
</Circuit>
</DataService>
</Services>
This was my xml which i have inserted into DB for the column XMLTYPE.Now i need to update few values in this whole file like values of
ID under<DataService>
Name under <DataService>
ID under <Contract>
Description under <ProvisioningStatus>
i was using the UPDATEXML query to update those it's saying i row updated but when i extract it says null.
Please help me out to solve this problem.
Thanks in advance. -
NOTIFICATION QUERY FOR UDF COLUMN
Dear experts,
I want notification query for delivery should not be add without fill up the information in machine number column (UDF Column- U_MCnumber)
Please do needful.
Thanks & Regards,
AkshataDear all,
I have got query ...........
If @object_type = '15'and @transaction_type= ('A')
BEGIN
If Exists (Select T0.DocEntry from ODLN T0 Inner Join DLN1 T1
On T0.DocEntry=T1.DocEntry INNER JOIN OITM T3 ON T3.ItemCode = T1.ItemCode
Where (T1.U_MCnumber Is Null and T3.ITMsgrpcod='119')
And T0.DocEntry = @list_of_cols_val_tab_del )
BEGIN
Select @error = -1,
@error_message = 'Please fill up machine number!!!'
End
End
Thanks & Regards,
Akshata -
Query for Totals on a Sales Order
Does someone have a query for sales order that sums the total # of orders for each user and sums total quantity and Amts?
ThanksThat would not be a hard query to write. If you have started on the query, you may paste it if you are having difficulties getting the desired result.
Suda -
How to display text in reverse order ?
I was wondering how to display data [text-numbers...etc] in the reversed order.
E.g.
if the data is as follows:
ORACLE
it should be displayed as:
ELCARO
thanx in advance !An alternative would be a MODEL clause solution:Nice!
Here another alternative with only one measure:
SQL> create table t
2 as
3 select 'bocajijA' col1 from dual union all
4 select 'ORACLE' from dual union all
5 select null from dual
6 /
Tabel is aangemaakt.
SQL> select old_col
2 , col1
3 from t
4 model
5 partition by (col1 old_col)
6 dimension by (0 i)
7 measures (col1)
8 rules iterate(10000) until (iteration_number = length(col1[0])-1)
9 ( col1[0]
10 = substr(col1[0],1,iteration_number) ||
11 substr(col1[0],length(col1[0]),1) ||
12 substr(col1[0],iteration_number + 1, length(col1[0])-iteration_number-1)
13 )
14 /
OLD_COL COL1
bocajijA Ajijacob
ORACLE ELCARO
3 rijen zijn geselecteerd.Regards,
Rob. -
Single query for displaying all but 1 column values for all tables
Hi,
All the tables have SYS_CREATION_DATE column.
But I dont want to display this column value
Can someone suggest some way in which i could achive this?
Oracle version:11gR1
OS:SunOS
Cheers,
Kunwar
Edited by: user9131570 on Jul 6, 2010 7:57 PMuser9131570 wrote:
@Tubby
I *want to display table-wise the values of all but 1(SYS_CREATION_DATE) columns in my database.*
I need this in order to compare it to another database for all these values .Let me make a wild guess at what you are getting at.
Given these two tables
create table emp
(empid number,
empname varchar2(15),
empaddr varchar2(15),
sys_creation_date date);
create table dept
(deptid number,
deptmgr varchar2(10),
sys_creation_date date);you want to somehow combine
select empid,
empname,
empaddr
from emp;with
select deptid,
deptmgr
from dept;into a single sql statement? -
Is there any Standard SAP Report?for displaying Billing block/Status-Order
Hi,
Am a ABAP Developer. I heard that there is SAP Query/ABAP Query/Standard SAP report for the below functionality/requirement. SO, pls. let me know if there is any SAP Query/ABAP Query/Standard SAP report?
"This report is suppose to display Credit and Debit memo documents which are blocked and yet has a status of APRV; the other display is for Return Documents which are blocked and yet has a status RCVD."
thanqHi,
Use t-code
V23 - Blocked sales document for billing
VA14L - Sales document blocked for delivery
VFX3 - For blocked billing documents.
Kapil
Edited by: Kapildev Farakte on Jan 8, 2010 4:15 AM -
How to display photos in reverse order (new to old) in photo stream?
In the main Photo Stream (my Photo Stream) which often contains many photos, is there a way to reverse the display order so the newest pictures are shown first? This was the default in one of the old software versions. It would nice nice to have a button to do this.
No, but if you wish to provide feedback to Apple you can do so using the link.
http://www.apple.com/feedback/ -
Logic for display column on condition
HI Experts,
I need to make report in which on User input in check boxes the desired colums will display. This report is Customer aging. I have 4 check boxes.
1. 0-60 days
2. 61-90 days.
3. 91-120 days
4. 121-180 days.
User can check any check box wether it is single or 1 & 3 or 2 & 4 or 2 & 3 etc. to see the desired coloum. wHAT WILL BE THE logic and code to display the clicked colums. if it is difficult then u can display all colums but the data shuld b in clicked columns. iTs urgent.
Thanks.
KhanHello Khan,
I dont know about displaying only those columns, you may have to put different write statements for each possible case
for getting blank values to be displayed in unchecked columns, you can use this
(since i dont know your field names, i have given my own names)
if p_sixty = ''.
loop at itab.
itab-sixty = ''.
modify itab.
endloop.
endif.
if p_ninety = ''.
loop at itab.
itab-ninety = ''.
modify itab.
endloop.
endif.
if p_onety = ''.
loop at itab.
itab-onety = ''.
modify itab.
endloop.
endif.
if p_oneey = ''.
loop at itab.
itab-oneey = ''.
modify itab.
endloop.
endif.
loop at itab.
write:/ itab-sixty , itab-ninety, itab-onety, itab-oneey.
endloop.
Maybe you are looking for
-
I recently installed another HD in my laptop. Current "C" drive only 60GB, have over 20k songs, and use computer to DJ sometimes. Intsalled another drive alongside C, named it "M" 500GB. Transferred all files to M. Changed path in itunes to itunes/M.
-
It's possible to make Hierarchical Tree from multiple tables ?
the famous example for Hierarchical Tree is about employee_id and manager_id field in employees table ............ so I was wondering it's possible to make[b] Hierarchical Tree from multiple tables ? and How ?? if the answer associate with example th
-
Dutch end-user manual spa50x series
I am looking for dutch user guides for the spa50x series of IP phones. For instance, on the cisco website I can only find a document named 'cisco_spa509g_user_guide.pdf' in English whereas I would like a Dutch version of this to supply to Dutch custo
-
Does anyone know of a standard extractor for ISEG (Physical inventory)? Thanks
-
Automate - presentation in photoshop CS4
Hi all, Hoping someone can help! I use photoshop CS3 still in college but have bought photoshop CS4 for home. In college we have been taught to use automate to create presentations or digital portfolios. In the CS3 menu under automate there is an opt