Any approach other than the use of a function
HelloI use Oracle 10.2.0.4.0 version
Create tabel
CREATE TABLE TEST
( GROUP_NUM CHAR(8 BYTE),
DIVISION_NUM CHAR(5 BYTE),
DIVNAME CHAR(40 BYTE));
Insert a table insert into test (GROUP_NUM,DIVISION_NUM,DIVNAME) values ('123','0001','deltatrans');
insert into test (GROUP_NUM,DIVISION_NUM,DIVNAME) values ('123','0002','deltatrans1');
insert into test (GROUP_NUM,DIVISION_NUM,DIVNAME) values ('123','0003','deltatrans3');
insert into test (GROUP_NUM,DIVISION_NUM,DIVNAME) values ('456','0001','transatlan');
insert into test (GROUP_NUM,DIVISION_NUM,DIVNAME) values ('456','0002','transatlan1');
insert into test (GROUP_NUM,DIVISION_NUM,DIVNAME) values ('456','0003','transatlan2');
Select * from testgroup_num division_num divname
123 0001 deltatrans
123 0002 deltatrans1
123 0003 deltatrans3
456 0001 transatlan
456 0002 transatlan1
456 0003 transatlan2
I need the output voltagegroup_num division_num divname grpname
123 0001 deltatrans deltatrans
123 0002 deltatrans1 deltatrans
123 0003 deltatrans3 deltatrans
456 0001 transatlan transatlan
456 0002 transatlan1 transatlan
456 0003 transatlan2 transatlan
The grpname column should display the value in the divname column where the divison_num is the minimum for this group.Currently I use a function to do
Function:
CREATE OR REPLACE FUNCTION
fn_testgpname (
GPNO IN VARCHAR2 )
RETURN varchar2
AS
RESULT varchar2(40);
BEGIN
select divname into result from test
where group_num = gpno
and division_num = (select min(division_num) from test where group_num = gpno);
RETURN RESULT;
EXCEPTION WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE (SQLERRM);
DBMS_OUTPUT.PUT_LINE (RESULT);
RETURN NULL;
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE (SQLERRM);
DBMS_OUTPUT.PUT_LINE (RESULT);
RETURN NULL;
END;
/
I'm going to call the function in the qry asSELECT GROUP_NUM,DIVISION_NUM,DIVNAME,fn_testgpname(group_num) grpname FROM TEST
Also, I noticed when I create a table with the above statement ascreate table testing as SELECT GROUP_NUM,DIVISION_NUM,DIVNAME,fn_testgpname(group_num)grpname FROM TEST
the structure of the table is like thisCREATE TABLE TESTING
(
GROUP_NUM CHAR(8 BYTE),
DIVISION_NUM CHAR(5 BYTE),
DIVNAME CHAR(40 BYTE),
GRPNAME VARCHAR2(4000 BYTE)
)
Why did the grpname returned as varchar2 (4000 byte)?Thanks in advance.
My response above.
>
The reason why your table is created with varchar2 (4000), it's that your function returns a varchar2. If oracle picksup default maximum limits for varchar2 and creates the column.
Limit Max for varchar2 is 4000.
>
The reason why he picks up the maximum limit is that... Your function can return a string up to 4000 bytes. Thus, it creates the column with 4000.
If you want with 40 even you can convert,
CREATE TABLE test1 AS
SELECT group_num,
division_num,
divname,
CAST(first_value (divname) OVER (PARTITION BY group_num ORDER BY division_num) AS char(40)) AS grpname
FROM TEST;
G.
Tags: Database
Similar Questions
-
On our home network, we want to be able to send messages between a WIN 7 laptop and an XP laptop. We can use Messenger, obviously, but if one or the other is not signed, it means travelling wing to the West Wing to get the other to connect. Maybe he went back to the old telephone company!
All the serious answers welcome, thank you.
Not sure, but it can help - http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/msgexe-netsend-anything-availible-on-windows-7/e9743edc-afa9-4942-b1c7-66baf443067b (I have not tried just found it on a search)
Maybe there are things like that (found on google)? - http://www.cezeo.com/products/netsend/
As I say, Ive not tried so if you download, check AV before installing.
-
What are some editing apps good free photo for Mac, other than the Photos of Apple?
Hi everyone, I'm looking to see what free apps, you guys use for editing photos? I have a photography class to come and play with options other than the use of pictures of the Apple app. Nothing against the app, I just learn more. Thank you.
Strange question to the users of the forum pictures - of course, the answer is Photos for Mac
Photos is optional and if you don't like it, then, Google is your friend
LN
-
How can I farm Metro application other than by using the Task Manager?
How can I farm Metro application other than by using the Task Manager? If there is no way, please add a close button, Microsoft.
Hello
· What version of the operating system is running on your computer?
Alternatively, press ALT + F4 to close the application.
-
I just bought a 6 d. is it possible to use the grid in other than the auto mode?
I just buy a 6 d. Is it possible to use the grid in other than the auto mode? Also, is there a way to use the self-timer in other than the auto mode?
Thank you very much. I look forward to your comments.
I have to assume that your camera came with a manual you need to rely on. In my manual for my 7 d Mark 2 the index near the end of the manual lists the applicapable pages for whatever this is relating to the use or other people. Grid is under G, Self Timer is under S and called "self-timer."
If you use a computer based pdf to see the info it will probably be several pages listed, but you can click on a page number to get to it rather than scroll to it.
-
Firefox is redirect to sites other than the one clicked on.
When you click on search sites by using the bar (address bar not) search, you are redirected to one site other than the one you clicked on. It happens not on all sites found, but on a large number of them. However, in all cases where sometimes the site redirected to is [adlinksearch.com]. I use PC Tools Spyware Doctor and it has found no problems with Malware. I can go on the site if I put the address in the address bar. I use igoogle search bar. Please help with this issue, because it is very annoying.
This has happened
Each time Firefox opened
== Unknown as to exactly when he started
Firefox closes alltogether when you go to youtube videos, not youtube itself. Redirects to other sites. ran malaware and spybot. Any suggestions?
-
PXI-8250 in one frame other than the 1042/1045 or PXI-1044?
The PXI-8250 will work at any level in one frame other than the 1042/1045 or PXI-1044?
Hi djfrye.
The PXI-8250 can only be used in the 1042 / q 1042/1045. It will not work in the PXI-1044.
Good luck with your application!
-
My hard drive crashed and I didn't do a reinstall full Vista no problem here other than do not pay attention, I installed the operating system on one 80 GB disk other than the new 320 gig which was. After the new facility and all new updates, I have 25 GB of free space. I would like to know if I can install new programs on my drive d: and no filling of drive c: for the ability
Hello
Thanks for posting this question in the Microsoft Community Forums.
I see you want to know if you can install programs on a drive with no operating system.
I wish to inform you that this is possible with only specific programs, which give the user an option to choose where the program is installed.
When a program is installed, it runs in program files, which lies in the operating system drive and can not be moved elsewhere.
Another reference:
Microsoft does not support changing the location of the program files
http://support.Microsoft.com/kb/933700
I hope that you found this information useful.
Please get back to us if you have any other questions about windows.
-
Keep other than the folder RES - OBIEE 11 g jpeg files
Hi all
I'm trying to keep jpeg files in one path other than the default, because we have millions of files to keep. I found a few forums explaining how to proceed. It is said to change the weblogic.xml file that is available in the
Step 1: Navigate to the path of C:\OBIEE11G\Oracle_BI1\bifoundation\jee and analytics.ear open.
Stpe2: By opening the ear file, we can see the analytics.war file, open the war file.
Step 3: now click on the WEB - INF folder and open weblogic.xml file.
But I couldn't find the weblogic.xml in the path below. I opened analytics.ear and analytics.war using winzip. Can someone help me to satisfy this requirement. Thanking in advance, you and any help will be appreciated.
This is something that is available on the Web site. I was in need to find the forgotten in the drive weblogic.xml file. In any case, I managed to create a new file weblogic.xml and solve this problem. But my current problem is now I am able to access the files on the way. But I'm unable to access the files from the Folder (Default) RES
-
The pencil of Apple requires a port light to recharge. Does anyone know a USB male to female adapter port lighteners that would load the pencil on one device other than the iPad?
Apple pencil comes with its own map of woman to woman, so you can use a standard lightning cable USb and charger to charge
Not sure there is no 3rd party yet.
-
How can I upgrade any OS other than El Capitan?
I'm currently under Snow Leopard and have not had a problem... until Apple has decided to update my iPhone... now it won't sync with my iMac because the OS is obsolete. Ok.. whatever... but the only available upgrade is at El Capitan. My iMac is too old to upgrade to El Capitan, but it should be ok for other versions of the OS. Other versions are not on the app store... someone has any suggestions other than buying a new iMac (I refuse to do). Apple has been so good, but lately I'm losing faith.
If your Mac is too old for El Capitan, then its too old for anything else except Lion. Nothing after the Lion has the same system requirements as El Capitan. 4 OS versions so far, which have not changed the system requirements.
But to be sure, what exact model, year of iMac do you have?
If you really want to install Lion, you must purchase a download on the Apple Online Store code:
-
When I right click Start button select Explorer, I can decide what folder is open other than the start menu and dozens of file extensions?
Can we just my computer with the list of drives?
thanx
Hello
I suggest you to follow these steps and check if that helps:
a. right click on the Windows Explorer icon
b. in the menu that appears, click Properties.
c. in the target box, add the command line switch ' / root ' to the "% SystemRoot%\Explorer.exe" command, using the startup location that you want.
d. for example, if you want Explorer of Windows to start at the root of drive C, edit the command as follows:
% SystemRoot%\explorer.exe/root, C:\It will be useful.
-
How can I set the format of Windows Media Center at 16:10 in other than the full screen?
How can I set the format of Windows Media Center in Vista at 16:10 in other than the full screen? I use a screen as secondary display 1680x1050px.
Hello, YPOC
It is not possible to change the proportions for Media Center in windowed mode.
The aspect ratio has been changed in Windows 7 and uses a format screen mode to windowed.
-
I can't get my computer in safe mode. The custom of menu f8 "Let me pick something other than the normal mode. My keyboard works perfectly fine (obviously since I could press f8), but it won't let me choose Safe mode. I have a Trojan horse on my computer so I'll try to get it in safe mode.
Hello
Start - type in the search-> MSCONFIG box find top - make a right click on - RUN AS ADMIN
Control - Section Boot - Safe Boot Startup tab and check the boxes below if necessary - APPLY / OK - REBOOT.
===========================================================
It can be made repeatedly in Mode safe - F8 tap that you start, however you must also run them
the Windows when you can.Download malwarebytes and scan with it, run MRT and add Prevx to be sure that he is gone. (If Rootkits run UnHackMe)
Download - SAVE - go to where you put it-right on - click RUN AS ADMIN
Malwarebytes - free
http://www.Malwarebytes.org/Run the malware removal tool from Microsoft
Start - type in the search box-> find MRT top - right on - click RUN AS ADMIN.
You should get this tool and its updates via Windows updates - if necessary, you can download it here.
Download - SAVE - go to where you put it-right on - click RUN AS ADMIN
(Then run MRT as shown above.)Microsoft Malicious - 32-bit removal tool
http://www.Microsoft.com/downloads/details.aspx?FamilyId=AD724AE0-E72D-4F54-9AB3-75B8EB148356&displaylang=enMicrosoft Malicious removal tool - 64 bit
http://www.Microsoft.com/downloads/details.aspx?FamilyId=585D2BDE-367F-495e-94E7-6349F4EFFC74&displaylang=enalso install Prevx to be sure that it is all gone.
Download - SAVE - go to where you put it-right on - click RUN AS ADMIN
Prevx - Home - free - small, fast, exceptional CLOUD protection, working with other security programs. It comes
a scan only, VERY EFFICIENT, if it finds something to come back here or use Google to see how to remove.
http://www.prevx.com/ <-->-->
http://info.prevx.com/downloadcsi.asp <-->-->Choice of PCmag editor - Prevx-
http://www.PCMag.com/Article2/0, 2817,2346862,00.asp--------------------------------------------------------
If necessary here are some free online scanners to help the
http://www.eset.com/onlinescan/
http://www.Kaspersky.com/virusscanner
Other tests free online
http://www.Google.com/search?hl=en&source=HP&q=antivirus+free+online+scan&AQ=f&OQ=&AQI=G1--------------------------------------------------------
Also do to the General corruption of cleaning and repair/replace damaged/missing system files.
Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup
Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN
Enter this at the command prompt - sfc/scannow
How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
generates in Windows Vista cbs.log
http://support.Microsoft.com/kb/928228Run checkdisk - schedule it to run at the next startup, then apply OK then restart your way.
How to run the check disk at startup in Vista
http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html-----------------------------------------------------------------------
If we find Rootkits use this thread and other suggestions. (Run UnHackMe)
I hope this helps.
Rob - bicycle - Mark Twain said it is good.
-
Will there be repercussions to Program Files on one partition other than the operating system of the installation? Most if not all the software packages allow to customize the installation. I had an experience with OFFICE 2013 and this allowed me to install on a separate partition. After installation, I checked the menu START was 2013 OFFICE & I was able to launch PwrPt without complications.
My motivation for doing this is that I have several versions of LabView which occupies the huge disk space. So if I can separate the backup image of my OS program files is greatly reduced in size. This allows me to record several images of my OS by dates without needlessly chewing my external hard drive.
Anyone know this & if yes are there complications or questions?
Appreciate any feedback
I think I've found a more informative explanation via:
http://www.SevenForums.com/general-discussion/221347-install-personal-programs-partition-separate-OS-partition.html
Maybe you are looking for
-
Firefox doesn't work does not correctly on Windows 10
Well, I've upgraded to Windows 10 and since then, Firefox is not working properly (not not display graphics, google sites won't load do not, etc.), I tried uninstalling and reinstalling several times, I even waited for the new update... None of them
-
When I click on the file and click on print, no printing occurs by using kodak esp7
I have the ability to print when you use internet explorer, but cannot get anything it either happens on firefox.
-
Equium A60-173 does not start after the BIOS update
Hello people, I downloaded a BIOS updated toshiba for my Equium A60 - 173 and while it was loading on, restarted my laptop. Now, whenever I turn it on, the power light comes on for a few seconds, there is nothing on the screen and then it turns off a
-
mediaget2 is installed and running on my computer, how can I get rid of him?
Original title: program installation I learned that a program called mediaget2 is installed and running on my computer. I tried to open the program, but nothing has been posted. When I tried to uninstall, I was told that the program was running. Plea
-
Error number: 0x800CCC90 on Windows Mail on VISTA
Use Windows Mail on VISTA to access 3 e-mail accounts. Only on a single account, cannot receive, get the following, Account: 'staff', server: 'inbound.att.net ',.Protocol: POP3, Server response: '-ERR [SYS/TEMP] problem recover message.', Port: 995,