How can I get the nulls for the weeks later
Hi allWhen I run this code, I get records up to the current week.
How can I view the output that I get nulls for the weeks later. (with the help of the v_numOfWeeks variable in the code)
Thank you
Vikram
DECLARE
v_query VARCHAR2(4000);
TYPE ref_cursor IS REF CURSOR;
v_refcur ref_cursor;
v_sum NUMBER;
v_id NUMBER;
v_name VARCHAR2(1000);
v_weeknum NUMBER;
v_pernum NUMBER;
v_numOfWeeks NUMBER := 5;
BEGIN
v_query := ' SELECT SUM(product_bkg), postn_id, postn_tbl.postn_name, b.week_num, b.period_num
FROM ops_cv_extract b, (SELECT row_id, desc_text postn_name
FROM s_postn) postn_tbl
WHERE lvl_6_id = 5767
AND fiscal_year = 2008
AND b.week_num < 4
AND b.period_num = 3
AND b.postn_id = TO_NUMBER(postn_tbl.row_id)
GROUP BY postn_id, postn_tbl.postn_name, b.week_num, b.period_num
ORDER BY postn_tbl.postn_name, b.week_num';
OPEN v_refcur FOR v_query;
LOOP
FETCH v_refcur INTO v_sum, v_id, v_name, v_weeknum, v_pernum;
EXIT WHEN v_refcur%notfound;
dbms_output.put_line('P'|| v_pernum||'W'|| v_weeknum||' '||v_name||' '||v_sum);
END LOOP;
END;
/
This is the output when I execute this code.
P3W1 COMM CNTRL ISAM 213 26961.61
P3W2 COMM CNTRL ISAM 213 12870.4
P3W3 COMM CNTRL ISAM 213 245.88
P3W1 COMM CNTRL ISAM 273 72831.2
P3W2 COMM CNTRL ISAM 273 8739.38
P3W3 COMM CNTRL ISAM 273 3764.92
P3W1 COMM CNTRL TAM 213 49844
P3W2 COMM CNTRL TAM 213 20515.17
P3W3 COMM CNTRL TAM 213 16167.46
P3W2 COMM CNTRL TAM 216 12561.4
P3W3 COMM CNTRL TAM 216 2027.1
P3W1 COMM CNTRL TAM 273 -3336.71
P3W2 COMM CNTRL TAM 273 -1376.68
P3W3 COMM CNTRL TAM 273 19707.42
P3W1 Damon Walters -609.07
P3W2 Damon Walters 30030.24
P3W3 Damon Walters 37475.1
This is the output I'd like to get
P3W1 COMM CNTRL ISAM 213 26961.61
P3W2 COMM CNTRL ISAM 213 12870.4
P3W3 COMM CNTRL ISAM 213 245.88
P3W4 COMM CNTRL ISAM 213
P3W5 COMM CNTRL ISAM 213
P3W1 COMM CNTRL ISAM 273 72831.2
P3W2 COMM CNTRL ISAM 273 8739.38
P3W3 COMM CNTRL ISAM 273 3764.92
P3W4 COMM CNTRL ISAM 273
P3W5 COMM CNTRL ISAM 273
P3W1 COMM CNTRL TAM 213 49844
P3W2 COMM CNTRL TAM 213 20515.17
P3W3 COMM CNTRL TAM 213 16167.46
P3W4 COMM CNTRL TAM 213
P3W5 COMM CNTRL TAM 213
P3W1 COMM CNTRL TAM 273 -3336.71
P3W2 COMM CNTRL TAM 273 -1376.68
P3W3 COMM CNTRL TAM 273 19707.42
P3W4 COMM CNTRL TAM 273
P3W5 COMM CNTRL TAM 273
P3W1 Damon Walters -609.07
P3W2 Damon Walters 30030.24
P3W3 Damon Walters 37475.1
P3W4 Damon Walters
P3W5 Damon Walters
Published by: polasa on October 28, 2008 18:42
Hello
The subquery dum has 1 to 5 hard coded values:
(
44 select 1 week_num from dual
45 union all
46 select 2 from dual
47 union all
48 select 3 from dual
49 union all
50 select 4 from dual
51 union all
52 select 5 from dual
53 ) dum ,
Instead, use the following syntax, which produces the values from 1 to n:
(
SELECT LEVEL AS week_num
FROM dual
CONNECT BY LEVEL <= n
) dum,
n may be any numeric expression, including a scalar subquery.
Tags: Database
Similar Questions
-
How can I get Firefox looking for my computer for the plugins that are already there?
How can I get Firefox looking for my computer for the plugins that are already there?
Adobe Flash player is already on my computer from IE 8. How can I get Firefox to see that it is already on my PC and use it so I don't have to download it again and possibly create other problems. Also, in my efforts to download Flash, active Firefox IE that made me concerned that would cause problems that our just leave me where I am now, instance where IE can use a bottle but Firefox cannot.
Internet Explorer uses a version of the Flash player ActiveX plugin as it does not work with other browsers.
Download the version of the https://www.adobe.com/products/flashplayer/distribution3.html Plugin-based browsers and make sure Firefox is closed when you install it.
-
I am trying to sync my iphone to my computer via i-tunes soft ware. It does give me an option for the phone device. How can I get the phone icon in the menu bar?
Mac or Windows?
-
How can I get the tabs colorful to use different distinct colors for 2 gmail accounts?
Under Firefox 29.0.1 iMac OSX 10.9.3. I have multiple Google accounts: 2 1 Google Calendar and gmail accounts. Colorful tabs add-on will allow me to choose a color for a gmail account, but it also uses this same color for the other gmail account. How can I get the different colors on 2 gmail accounts?
In addition, colorful tabs is also the same for my homepage (google.com) and my google calendar. How can I get different colors on these 2?
Personally, I use 'Fabtabs' for my mozilla FireFox.
https://addons.Mozilla.org/en-us/Firefox/addon/FabTabs/
This add-on has problems like that when I use it.
-
How can I get the six digit code for my iPad Pro? I have two other iPads and an iPod but I get the codes I get and the Pro is just disabled for longer and longer whenever he rejects these codes!
-
How can I get the command bar, for e-mail, etc..
How can I get the command bar in Mozilla? For the icon to email etc.
If you want to learn the basics try this interactive and video tour
- http://www.Mozilla.org/en-us/Firefox/Central/
- or the articles of the help/products/firefox/get-started list
-
How can I get the manual for the new version of GarageBand?
I Went on the apple website and it had GarageBand ' 09, ' 08, how can I get the manual to the latest version of GarageBand?
There is only the online help for GarageBand 10.1, but not a manual: http://help.apple.com/garageband/mac/10.0/
- You can check the balls & FAQ of the BONE, there a GarageBand 10 video tutorials: http://www.bulletsandbones.com/GB/GBFAQ.html
- Edgar Rothermich wrote the big manuals for GarageBand, which are easy to follow and are available on the store iBook for a fee:
-
Satellite Pro U400 - How can I get the native screen resolution for external monitor?
I have a samsung syncmaster external screen connected to a Satellite Pro U400.
The resolution of the screen goes up to 1280 etc. but the minimum samsung is 1440 x 920 (ish I forgot).
How can I get the samsung to display full screen expanded to save my eyes of the realativively small screen internal?Hello!
Have you tried to update the display on your laptop driver? Check the Toshiba site for an update:
http://EU.computers.Toshiba-Europe.com-online decision-making supported Downloads & => Download driversIn addition, it would be interesting to know if you are running the factory settings or you have installed your own version of Windows?
And what operating system are you using? Have you installed all Windows updates?For external LCD, monitors, you must set the screen refresh rate of 60 Hz.
And if you want to change the resolution of the screen, you must select the second monitor in the graphics options on Windows.Good bye
-
How can I get the COMPLETE serial number to display? This number shows except for the 4 last digits.
Hi Infogoddess,
Thank you for using communities Support from Apple! If you try to find the serial number of your iPod touch or another Apple product, you can find information and the steps in the following articles useful:
iPod: how to find the serial number - Apple Support
Find the serial number of your Apple - Apple Support product
See you soon
-
How can I get the correct product key for my sleekbook want PC4
How can I get the correct product key for my sleekbook desire 4 PC
Hello
As mentioned in your other post you can get it from Microsoft with your money:
Kind regards.
-
How can I get the string value displayed on a digital control defined for the relative time.
I have a digital potentiometer to display relative time in increments of 30 minutes.
I want to record the value displayed on the control string. Unfortunately, when I use the "convert to decimal string.vi" number, the resulting string is just the value in seconds.
How can I get the value as a string? (for example 01:30 for an hour and thirty minutes)
Thank you
Sean
Hi Sean.C!
M_Peeker's suggestion is a good thing. A stage that could clarify things is that you must set the % t <%H:%M> format string entry.
< br / > Kristen:.
-
How can I get the color codes for the notebook
How can I get the color codes for the notebook?
Hello
What is the color codes for the notebook?
Perhaps you need a 3rd party utility like GetDiz - Free and others to be
found using BING or Google.GetDiz Notepad - free - replacement
http://www.Outertech.com/en/Notepad-replacementI hope this helps.
-
How can I get the shutter count for my Canon 7 d Mark II using Windows XP?
How can I get the shutter count for my Canon 7 d Mark II using Windows XP? I have been looking for many places and make downloads of files, but I can't seem to find anything. I am wary of downloading software that I know nothing. Any help is greatly appreciated.
Hi, I paid only $2.99 acquired program namely the supreme court on a 7 d Mark 2
Search: direstudio.com to find out.
-
How can I get the driver for a Dell Latitude D800 XP wireless?
I have a Dell Latitude D800 that I just did a clean install of XP SP3 to and the Wireless does not work. How can I get the driver for the card wireless to the computer?
Download drivers
Visit the manufacturer's Web site and select your model (this is usually done in the Support section). You should be able to download drivers for your model if they have drivers for your version of Windows. Download the driver and then follow the instructions to install.
Reference Dell Driver Downloads:
-
I have a desktop computer Windows 7 connected to an HP laserjet 4050N printer, when I try to print from a computer to Office XP, via the network, I wonder for an updated printer driver. I downloaded the latest print driver, but it does not recognize the file inf and again requests a current print driver. How can I get the XP desktop to print on the printer connected to the Windows 7 Desktop?
Hello
I suggest you to follow the steps mentioned below and check if it helps.
Method 1:
Printer in Windows problems:
http://Windows.Microsoft.com/en-us/Windows/help/printer-problems-in-Windows
For your reference: How to use Windows XP to share a printer with other people on your network: http://technet.microsoft.com/en-us/library/bb457001.aspx
http://TechNet.Microsoft.com/en-us/library/bb456988.aspx
To connect to a printer on a network: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/print_connect_net_printerw.mspx?mfr=true
Hope this information is useful.
-
How can I get the hybernation (at rest) for windows xp?
How can I get the hybernation (at rest) for windows xp?
Hi IreneHess,
You can enable the Hibernate power options. Click Start-> settings-> Control Panel-> power-> Hibernate Options-> enable hibernation.
I hope this helps.
Maybe you are looking for
-
iTunes Store recently added missing purchases
Since the upgrade to iTunes 12.4.1 my purchases of song/album iTunes Store is no longer appear in the list "recently added". Individual tracks are also not appearing in 'Song' registration and my iTunes game does not synchronize these purchases in an
-
omni27 HP: HP omni27 side buttons not working not
Hi, I have recently upgraded to windows 10. I also just bought a xbox one and now the buttons to switch between the game mode and pc mode do not work. So what happens I plug my hdmi and I can't even switch to game mode to use my xbox. I went through
-
Unable to access my Apple TV after you add the 2nd layer of security to my profile of Apple
Hi, I have authorized after Apple install a 2nd layer of security on my iPhone and basically add it to my profile. Now I can't access my purchases on my 2nd generation Apple TV (film music, video). There is no way to get the required security code, w
-
Writerdrive of DVDs does not not in Windows Vista
I use windows vista professional, 3 GB of ram & CPU 2 ghz. Whenever I insert a cd or a dvd in my dvd writer windows doesn't recognize it even if he did pretty much earlier. It says please insert a disc. now what to do?
-
Transfer files from the laptop Win 8.1 for win 7 laptop using the crossover cable
I am struggling with this all day and I don't have a lot of hair left. I am trying to transfer files as described in the issue based on this info: http://windows.microsoft.com/en-us/windows/connect-two-computers-crossover-cable#1TC=windows-7 8.1 win