Modifying display in oracle
Dear all;
I have an interesting problem
I have the following code
create table table_A
ID varchar2(200),
qty number(6)
insert into table_a
(id, qty)
values
('A', 10);
insert into table_a
(id, qty)
values
('B', 6);
create table table_B
ID varchar2(200),
colour varchar2(200)
insert into table_b
(id, colour)
values
('A', 'Red');
insert into table_b
(id, colour)
values
('B', 'Black');
create table table_info
ID varchar2(200),
addr varchar2(1000)
insert into table_info
(id, addr)
values
('A', '2034 James Street');
insert into table_info
(id, addr)
values
('B', '2044 Main Street');and I am using a select similar to do this
select g.id, g.qty, h.colour from table_A g, table_B h
where g.id = h.idwhich gives me the following display below
ID QTY COLOUR
A 10 Red
B 6 Blacknow I would like to modify the display so that I can get this instead
ID Addr
A '2034 James Street'
ID QTY Colour
A 10 Red
ID Addr
B '2044 Main Street'
ID QTY Colour
B 6 BlackAll help is appreciated. Thank you.
Hi,
Here's one way:
WITH union_data AS
SELECT g1.id
, TO_CHAR (g1.qty) AS column_2
, h1.colour
, g1.id AS sort_id
, 2 AS sort_line
FROM table_A g1
, table_B h1
WHERE g1.id = h1.id
UNION ALL
SELECT 'ID' AS id
, 'QTY' AS column_2
, 'Colour' AS colour
, g2.id AS sort_id
, 1 AS sort_line
FROM table_A g2
, table_B h2
WHERE g2.id = h2.id
UNION ALL
SELECT t1.id
, t1.addr AS column_2
, NULL AS colour
, t1.id AS sort_id
, 0 AS sort_line
FROM table_info t1
UNION ALL
SELECT 'ID' AS id
, 'Addr' AS column_2
, NULL AS colour
, t2.id AS sort_id
, -1 AS sort_line
FROM table_info t2
SELECT id, column_2, colour
FROM union_data
ORDER BY sort_id
, sort_line
;Here's how it works:
You already know how to get the output lines that contain the values of the qty and colour.
You can generate a header line for each of those lines, that has the labels 'ID', 'QTY' and 'COLOUR', and do a UNION to combine those result sets.
SELECT g.id
, TO_CHAR (g.qty) AS qty
, h.colour
FROM table_A g
, table_B h
WHERE g.id = h.id
UNION ALL
SELECT 'ID'
, 'QTY'
, 'Colour'
FROM table_A g
, table_B h
WHERE g.id = h.id
;Output:
ID QTY COLOUR
A 10 Red
B 6 Black
ID QTY Colour
ID QTY ColourThe problem with the output above is that the header lines should be interleaved with the data lines, first a header, then the data that goes with it. To do that, we can add some extra columns to each branch of the UNION that are just for sorting:
SELECT g1.id
, TO_CHAR (g1.qty) AS qty
, h1.colour
, g1.id AS sort_id
, 1 AS sort_line
FROM table_A g1
, table_B h1
WHERE g1.id = h1.id
UNION ALL
SELECT 'ID' AS id
, 'QTY' AS qty
, 'Colour' AS colour
, g2.id AS sort_id
, 2 AS sort_line
FROM table_A g2
, table_B h2
WHERE g2.id = h2.id
ORDER BY sort_id
, sort_line
;Output:
ID QTY COLOUR SORT_ID SORT_LINE
A 10 Red A 1
ID QTY Colour A 2
B 6 Black B 1
ID QTY Colour B 2That solved one problem, but created another one. We don't want to see the sort_id and sort_line columns; we just want to use them in the ORDER BY clause. However, in a UNION you cn't ORDER BY anything that's not in the SELECT clause. Depending on your front end, you might be able to hide those columns (in SQL*Plus, for instance, you can say "COLUMN sort_id NOPRINT"), but here's how you can get around the problem in pure SQL, by doing the UNION in a separate sub-query from the ORDER BY:
WITH union_data AS
SELECT g1.id
, TO_CHAR (g1.qty) AS qty
, h1.colour
, g1.id AS sort_id
, 2 AS sort_line
FROM table_A g1
, table_B h1
WHERE g1.id = h1.id
UNION ALL
SELECT 'ID' AS id
, 'QTY' AS qty
, 'Colour' AS colour
, g2.id AS sort_id
, 1 AS sort_line
FROM table_A g2
, table_B h2
WHERE g2.id = h2.id
SELECT id, qty, colour
FROM union_data
ORDER BY sort_id
, sort_line
;Output:
ID QTY COLOUR
ID QTY Colour
A 10 Red
ID QTY Colour
B 6 BlackThat's perfect for the data from table_a and table_b. To get the data from table_info as well, just add 2 more branches to the UNION, as shown at the beginning of this message.
It's a little inefficient to do 2 separate queries, one to get the data, and another to get the header, when those 2 queries use the same tables and the same WHERE clause. An alternative is to cross-join the table to another table (or, more likely, a result set functioning as a table), that has the values n=1 and n=2, and use CASE expressions to display either the data or its header. I'll leave that as an exercise for the reader.
Edited by: Frank Kulash on Jan 18, 2011 1:02 PM
Explanation added.
Similar Messages
-
Display in "Oracle Forms 10g" a BLOB item
Hey, anybody know if there was any java component or a way to display in "Oracle Forms 10g" a BLOB item, which contains no images, but files of type PDF, DOC, TXT ....
Thank you<p>The Enhanced HTML browser bean allows showing amost everything in its window. See this screen shot</p>
So you could download your stored document onto the AS or the client with the Webutil FILE_TRANSFERT package, or you could envisage top develop
a nice PL/SQL procedure that would send the content via the UTL_HTTP package.
Francois -
How to get the users list that can Add/Remove or modify Vendors in Oracle?
How to get the users list that can Add/Remove or modify Vendors in Oracle?
I need to generate a report like name and responsibility. ThanksThat query gives the Supplier information.
But what i would be needing is to find out the USERS in oracle who can Add/Modify or Remove Vendors.
I assume it should be based on the Responsibility. -
How to display a oracle table from a java program?
How to display a oracle table from a java program.
Hello friends, I have written a Java program, using oracle 10g as backend.
I want to display a oracle table as output. Im not getting how to display oracle table as a output table.. Pls help me
Thank youjayanthds, you're not going to get a satisfactory
answer to this here. it's too big a task to justbe
quickly outlined in a forum - the reply "all youneed
to do is to query you table and return it asJTable"
is worthless, for example, since the solution to
any problem can be distilled to such a
soundbite, if need be. doesn't make the solutionany
simpler
essentially you're asking "how do I write adatabase
application?". all you'll get is snippets of code
that, when fitted together, will eventually helpyou
do this, but you'll spend days and days comingback
saying "right, I've done that, now what?" until
either you or the forum gets frustrated with the
whole affair and the process stops
there are entire books written about this subject,
and countless tutorials and guides on theinternet.
you're better off going down that routehehehe.well, it's true! I used to have a manager that would outline the solution to a problem in a few lines of pseudocode, and then firmly believe that the actual solution would be just as brief and simple. shame his pseudocode included such lofty abstractions as "reformat all data" -
Nothing display in Oracle developer forms runtime-web...
i have started OC4J instance,no compilation error showed,when i run the form module nothing display in Oracle developer forms runtime-web.
how to resolve this?Hi skud
Pls state ur Os, Forms Version and the JIntiator Version from the control panel
if u r using forms 10g pls may be u forgot to set the following form the Form's menu
Pls Select > Edit Menu > Preferences > RunTime Tab > Set the Browser u have to use.
Hope this helps...
Regards,
Abdetu... -
Modifying Identity for oracle.security.idm.RoleProfile
Hello. In the documentation: http://docs.oracle.com/cd/E12839_01/core.1111/e10043/devuserole.htm#autoId36 it is written that we can modify the Property by using oracle.security.idm.ModProperty: http://docs.oracle.com/cd/E24001_01/apirefs.1111/e14658/oracle/security/idm/ModProperty.html class. From the example shown there we can modify property for oracle.security.idm.UserProfile: http://docs.oracle.com/cd/E16340_01/apirefs.1111/e14658/oracle/security/idm/UserProfile.html. But I am unable to setProperty for oracle.security.idm.RoleProfile: http://docs.oracle.com/cd/E15523_01/apirefs.1111/e14658/oracle/security/idm/RoleProfile.html class, since there is no such method defined.
How can I modify property for role. Can anyone show me an example or point to me into right direction?
Thanks in advance.
Regards.
Tapas.I may be found a solution. The interface oracle.security.idm.RoleProfile extends oracle.security.idm.Role and the oracle.security.idm.spi.AbstractRoleProfile implements oracle.security.idm.RoleProfile, in turns oracle.security.idm.spi.AbstractRoleProfile is an abstract class and this class is extended by following three classes:
1. oracle.security.idm.providers.stdldap.LDRole,
2. oracle.security.idm.providers.libovd.LibOVDRole and
3. oracle.security.idm.util.RoleProfileValueObject
All of them has setProperty(ModProperty modProp) method defined within themselves. Among them the oracle.security.idm.util.RoleProfileValueObject class throws oracle.security.idm.OperationNotSupportedException from setProperty(ModProperty modProp) method and it does not do anything.
In my application I need to find which one is the concrete implementation of oracle.security.idm.RoleProfile, so that I can proceed further. Before Monday I will not be able to do that. I guess it will work.
I need to break the source code. Don't know whether or not is is illegal. But I didn't have any other options. The documentation lacks in many places. Even the javadoc of the interface oracle.security.idm.RoleProfile does not mention the name of implemented classes of it. -
Config tool fails when trying to modify an existing Oracle EPM instance
I have a single server windows 2008 server environment with Foundation, prlanning, essbase , raframework, and EAL. I also have ODI installed in the same server. I was trying to add Strategic finance to the same envirnment . I downloaded the required files according to oracle install doc.
The installation was successful without any errors.
Problems started when I tried to configure it. AsI opened the config tool and chose
Modify an existing Oracle EPM instance ...
the config tool gave an error that
An unexpected error occurred and the application will have to be shut down . Review the error log , correct error condition and re-launch the application .
Kindly share your thoughts on this issue
Edited by: Saurav Sarkar on Apr 5, 2012 12:55 PMDid you examine the configtool log to see if it has more information on why the configurator shutdown, if you not sure where to find the logs have a look at http://docs.oracle.com/cd/E17236_01/epm.1112/epm_install_troubleshooting_11121/ch03s02s05.html
Cheers
John
http://john-goodwin.blogspot.com/ -
How to modify display label in error message raised from capi?
How to modify display label in error message raised from capi?
qms_transaction_mgt.process_rule_violation
( p_br_name => 'BR_PBR_DEL006'
, p_msg_code => 'PMS-00417'
, p_display_label => display_label
, p_table_name => 'pan_project_members'
, p_table_rowid => get_rowid
regards,
marcelWhen you mean which columns are displayed, this is actually quite easy.
Display_label will display by default the unique key columns, or if no unique key exists, the primary key. To overrule this behaviour, you have to specify the columns you want to display by assigning them a 'descriptor sequence'.
For example, to display the ename on EMP warnings, assign descriptor sequence 10 to the EMP.ENAME column and regenerate the CAPI package.
Jeroen van Veldhuizen -
Manually modify DISPLAY port number
Our 11.5.9 system has ADF concurrent report, we started up a X background service at Admin tier for Report server running. As request from the UNIX admin, we need change the port number for X windows. Since it is production, we have lots of customization, I want to avoid undate the context file and run the autoconfig. Therefore, I tried to modify the DISPLAY parameter in environment files on both tiers directly. However, it does not work. Does anyone know what I missed?
Here is the file list I touched.
adcmctl.sh , adrepctl.sh , $IAS_ORACLE_HOME/Apache/Jserv/*.properties on both tiers, re-bounced the whole application afterwards.
Thanks
SeanThere should be an entry for the DISPLAY variable in the application env file. This entry is created from the context file and after running AutoConfig. Also, make sure that the DISPLAY is set in the applmgr user profile.
I used to follow the same procedure when configuring the DISPLAY in non-AutoConfig environments, update the env file manually and make sure it is set in adcmctl.sh before staring the CM.
The list of files while should be updated manually are listed in the following note (Under "Running Applications 11i Reports Result in REP-3000" section):
Note: 200474.1 - Comprehensive REP-3000 Troubleshooting and Overview Guide
https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=200474.1 -
Modifying Form Behaviour Oracle Applications
Hello:
I have a problem with a form in Oracle Applications 10.7.0.
FORM - RCVCOFND.fmb ( Find Expected Receipts (16) ) Receiving--> Receipts
Upon entering this form Input Focus defaults to "Source Type". Users have decided that they would like to Default to "Purchase Order" item upon entry to this form.
I added code to CUSTOM.PLL that tests for WHEN-NEW-FORM-INSTANCE and form_name however form_name returns "RCVRCERC" which is not the form that I want to modify navigation.
Further investigation reveals that form RCVCOFND has its own PLL, BUT we are not allowed to modify this PLL, only the CUSTOM.pll is modifiable.
Does anyone have any suggestions or could advise on a workaround please.
Oracle Applications 10.7.0 SC161
Oracle Applications Client SC161
Application Object Library 7.5.16.02
Oracle Forms 4.5.7.1.8
RDBMS 8.1.6.3.0
Thanks.
N.1. Copy your form (test.fmb) into $AU_TOP/forms/US
2. Compile with f60gen
3. Copy the test.fmx file to $PRODUCT_TOP/forms/US
4. Login to Oracle Applications with sysadmin user
5. Select Application Developer responsibility
6. Navigate to Application - Form -
7. Enter the values for following parameter
Form = test
Application = You can select from LOV
User Form Name = Enter as you like
Description = Enter if any
8. Navigate to Application - Function
9. Enter the values in the function form
in Description TAB - Enter the value for Function, User Function Name, Description
in Properties TAB - Type = FORM
Maint.Mode Support = None
Context Dependence = Responsibility
in Form TAB - Form = Select your form name that already registered (above one)
Application = Will display
Parameters = STARTUP_MODE= TEST
10. Now you can attach the form in Menu then Responsibility
Revert back if you have any query.
Regards,
S. Velusamy Raja
Oracle Apps DBA -
Display Integrated Oracle Report in New Browser Window
Hi All,
I am using APEX 3.0.1 and Reports Builder 10g and have integrated my Oracle Reports (.rdf) successfully with APEX.
The trouble is that the report output (in PDF format) is opening in the same browser window as my APEX application and I would like to spawn a new browser window to display the report output.
The report is being called from a button with a Target of URL and the URL Target is:
&REPORTS_URL.&module=DEBITNOTE_REP.rdf&destype=cache&desformat=pdf&P_DEBITNOTEID=&P73_DEBITNOTEID.
Kind Regards,
Gary.Hi Garry,
Had to do the same thing last week.
1. Create a javascript function that accepts the report parameters and calls the window.open function for the reports URL
2. Change the URL on the report button to call this new function
It might also be worth using a cmdfile (see reports doco) to simplify the URL
cheers,
Ron -
Arabic language not displayed in Oracle 11g
Dear all,
I have problem in inserting data Arabic language into oracle database 11g.. it displays " ??????? "
I am programming a php application that insert data into oracle database, and I did as described in forums but still not working.
here is what i did:
NLS_LANG value is set to AMERICAN_AMERICA.AR8MSWIN1256
Database character set is: AL32UTF8
Arabic language is installed in windows regional and language settings, and Arabic keyboard
HTML page character set is: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I cant figure out whats causes the problem in my case. any help will be much appreciated.
RegardsHi guys
and thanks for the replies.. and sorry for my late reply
I tried using ARABIC_UNITED ARAB EMIRATES.AR8MSWIN1256 in NLS_LANG but still the same issue,
The way am viewing the input is via Oracle Enterprise Manager.
And the way am inserting the values are via html form and php.
Also, I tried selecting data and viewing it in the browser but also show "????"
I haven't try AL32UTF8 instead of AR8MSWIN1256 yet, am gonna try and reply soon.
Thanks -
Icons not displaying in oracle forms.
Hi All,
I am trying to display icons on Oracle forms 10g.I just brought over these forms from another system and I am trying to display the icons like next record, clear form etc..
I have done the following steps so far. The icons are still not displaying. Appreciate any help.
Created a folder in D:\oracle\oracleas\forms\java called icons.
Copied all gif files and jpeg files into icons. Then created a jar file.
D:\oracle\oracleas\forms\java>jar -cvf my_icons.jar icons
It created the jar file in the same directory D:\oracle\oracleas\forms\java
Also changes were made to these files as shown below each file.
forms.conf
AliasMatch ^/forms/icons/(..*) "D:\oracle\oracleas\forms\java\icons/$1"
registry.dat
default.icons.iconpath=http://servername:7778/forms/java/
formweb.cfg
# Forms applet parameter
codebase=/forms/java
# Forms applet parameter
imageBase=codebase
# Forms applet archive setting for JInitiator
archive_jini=frmall_jinit.jar,frmmain.jar, frmjdapi.jar, my_icons.jar
# Forms applet archive setting for other clients (Sun Java Plugin, Appletviewer, etc)
archive=frmall.jar,frmmain.jar, frmjdapi.jar, my_icons.jar
Also added this line under orion-web-app in orion-web.xml file.
<virtual-directory virtual-path="/icons" real-path="D:\oracle\oracleas\forms\java\icons" />
Restarted the OC4J forms server after any change.To test your configuration, you can try building an URL:
i.e.
http://localhost:8889/forms/frmservlet/icons/iconname.gif
Does it show the icon ?
If that does not work, I would try re-generating the my_icons.jar file, but instead of going directly to the forms/java/icons folder, copy the icons folder to the root directory i.e. c:\icons and execute the command to jar the icons folder, then redeploy the my_icons.jar file.
Then try again with the URL... if the URL does not work, you still have configuration issues.
PS: Don't forget to clear the cache in your browser so that the new .jar files is loaded?
Furthermore:
========
Remove the changes made to the forms.conf and orion-web.xml, they are only needed if the icons are
not stored in a .jar file.
forms.conf
AliasMatch ^/forms/icons/(..*) "D:\oracle\oracleas\forms\java\icons/$1"
orion-web.xml
<virtual-directory virtual-path="/icons" real-path="D:\oracle\oracleas\forms\java\icons" />
Edited by: Rodolfo Ferrari on Jun 17, 2009 6:14 PM
To double check your configuration, follow steps in metalink note 232413.1 - How to Deploy Iconic Images via a JAR File in Forms 9i/10g?.
Edited by: Rodolfo Ferrari on Jun 17, 2009 7:19 PM
Edited by: Rodolfo Ferrari on Jun 17, 2009 7:24 PM -
SDO_GEOMETRY displaying in Oracle SQL Developer (freezing)
Hi,
I am using Oracle SQL Developer (V 1.5.3) heavily at work, and have noticed some undesirable behaviour when the table's data tab is trying to display SDO_GEOMETRY. In this version (and subsequent ones) Developer tries to convert the geometry to WKT, instead of just displaying "sdo_geometry". I can see why this has been added in, however I am using many geometries that are quite large, and have extremely large sdo_ordinate_array/s . This is causing Developer to appear to be freezing while it runs the conversion, often hanging for many minutes at a time. I have briefly looked at V 2.1, and it appears to be the same.
Does anyone know if there is a check box option, or similar to switch this behaviour off? Limiting the number of rows returned has been suggested, but even when dealing with a STATES table the 9 rows needed for all 9 Australian states is far too large for a data tab display. If an option doesn't currently exist, it might be worth adding in to future versions of SQL developer.
regards, JeffHello,
I´ve the same problem. I use version 3.0.03 (3.45) but I can´t find the possibility to change this option.
Can someone help me?
Thanks
Peter -
How to display a oracle database?
hi everybody,
I have create an oracle database with the sql line command. so do somebody hav a tool or wizard to displays it (like in sql server we have DBAMgr2k). thanks to help meHOST NAME is the name of the machine in the net, or IP address of the server, where he is database.
I still inform that exists a specific forum for this tool, in:
SQL Developer
Maybe you are looking for
-
Album sort order PSE11 - is it by design ?
When experimenting with the sort order of albums in PSE11, I was surprised to see that in some albums, changing the sort order from 'oldest' to 'newest' did not produce any effect. The reason of this probably lies in the menu /preferences/general : I
-
How can I see what apps are running on my iphone 5?
Is there an app that will show me the apps running and also allow me to close apps that don't need to be running?
-
Dual cards, for more displays
so this mac pro, currently has an ati X1900 card installed, which has 2 DVI ports on it. Bottom line, im thinking about maybe having up to 3-4 displays hooked up to this thing symaltaniously. One of these I may want to be my Old SD 60" TV which onl
-
What is the use and functionality of a message type
Hi, I am new to abap. Can anybody tell me what is the use of the message type? What is it used for? There is an interface which is using an extended idoc type ZFIDCCP02 (Basic Type FIDCCP02). This extended idoc type is used for other interfaces and t
-
Video downloads volume 3db lower than Music downloads
I dont know if this is the proper area for this , but no matter what settings I play with my video downloads from the Music Store are about 3db lower than the music I download ( that is HALF as loud as the other for you non engineers) Pream settings