Having trouble with the PLSQL variables.

OK, I'm an intermediate to advanced multilingual programmer, but somehow the art of using variables and guests in plsql escapes me.

Here's what I have to do.

I need to pass a parameter of 4 figures, in the form of MMYY, for the month and the year running for.

I have so I need substring on the month and year and use them in the two header of State as well as in filter criteria.

I have it all working except participle past variable and using substring to the mm in separate variables of the AA and then using the 'yy' in where clause.

This is a versino abbreiated of my script so far. As you can see I've still '07' hard-coded. What I have to do is to take the LV_MMYY (which is 4 characters), substing on the last 2 of them (substr (& LV_MMYY, 3, 2)), store that value in a variable and then use that variable in the where clause.

You can provide any help would be greatly appreciated.

> > > > > > > > > > > > > > > > > > > > > > > > > > > >

SET linesize 157 54 echo OFF pagesize
THE VALUE NUM 6
SET FEEDBACK OFF
SET TO SHOW OFF
SET VERIFY OFF
SET RECSEP EACH

SET LV_MMYY = & & ENTER_DATE_IN_MMYY_FORMAT;

Mymonth COLUMN NOPRINT new_value by TANK
WE BREAK mymonth
COLUMN mymonth new_value by LV_MONTH
SELECT TO_CHAR (TO_DATE (SUBSTR ('& LV_MMYY', 0, 2), 'mm'), 'MONTH') mymonth FROM DUAL;

Myyear COLUMN NOPRINT new_value by TANK
WE BREAK myyear
COLUMN myyear new_value by LV_YEAR
SELECT '20'. SUBSTR ('& LV_MMYY', 3, 2) myyear FROM DUAL;

COLUMN today NOPRINT new_value by TANK
BREAK ON TODAY
COLUMN TODAY NEW_VALUE MYDATE
SELECT TO_CHAR (SYSDATE, 'YYYYMMDD') today FROM DUAL;
CLEAR BREAKS

TTITLE LEFT ' report "MYDATE" JANUARY THRU 'LV_MONTH' for the year financial report 'LV_YEAR' ' SKIP 2 -.

SELECT *.

Of
wrk_tab
WHERE
an = '07' - needs to get of the parameter
;
SQL> var yy varchar2(2)
SQL> begin
  2  :yy := substr('&LV_MMYY',3,2);
  3  end;
  4  /
vecchio   2: :yy := substr('&LV_MMYY',3,2);
nuovo   2: :yy := substr('0310',3,2);

Procedura PL/SQL completata correttamente.

SQL> select :yy from dual;

:YY
--------------------------------
10

If your where condition becomes

year =: yy

Max
http://oracleitalia.WordPress.com

Tags: Database

Similar Questions

  • I'm having trouble with the serial number

    I'm having trouble with the serial number

    If you are hearing 3 or an earlier version, the activation server was arrested.  Take a look at this page, Download Adobe Acrobat 7 and Adobe Creative Suite 2 products for instructions on how to download another copy of AA3.01 and use a generic serial number.  (For the purpose of the present hearing 3 counts as CS2 even though he was not part of the Creative Suite then.)

    However, if you are using a later version of the hearing (CS5.5 until the current 2015 CC) while the others are right... you will need to contact customer support Adobe because only they have the serial number details.

  • Beginner jQuery is having trouble with the links and the page redirect and page caching.

    Hi all

    I'm trying to update an old legacy of multipage site (each page has headers html etc.), adding jQuery Mobile. Most of the time it goes well, but I'm having some problems with the links, the redirect of the page, and caching.

    I write javascript like this...

    < script >

    -do things - then-

    Window.Location.Replace ("Page1.html");

    < /script >

    and links like this


    < a class = "-ui ui-btn-b btn tsize1" href = "page2.html" rel = "external" > page 2 < /a > "


    CACHING ISSUES


    On many pages - such as those that I have problems with, I've added no caching of code as...

    < head >

    < META HTTP-EQUIV = "Pragma" CONTENT = "no-cache" >

    < META HTTP-EQUIV = "Expires" CONTENT = "-1" >

    ... more...

    < head >

    Problem: for example, I can go to Page 1 and click on a link to go to page 2 and page 2 has the lines "no cache" header. The problem is that a fresh change of page 2 does not appear even with no cache lines above and even if I hit refresh in the browser that I thought it was supposed to reload the page (live get of the site). On the contrary, it seems to continue to see the old content before the update.

    In another case I could be on page 21 and click on a link that goes to the publicationfootnote22 and made a few treatment database and then goes to the page33. In this case, my fees top22 updates are not appearing and showing just the old cache data.

    Q: what is the best way, at least while I am writing code, to force the Page to refresh (non-cache), I can see my updates all the time, because otherwise it becomes very confusing because I'm sure you know.

    Thanks in advance: Dave

    Hi Dave,.

    Are you handy with your developer tools? It's always where I head when I need to look inside something. Before getting anywhere in addition or developed, check the response code you get for the page request and see what is the numeric code. If it is 200, you get a new copy. If it is 304 then your browser is striking the same content or something in your UI is to preserve the previously loaded document fragment.

    Photos make it easy, Chrome this is grabbing a small page for the first time and with disable cache enabled, and we get the status code 200:

    If I keep refreshing with "Disable cache" activated so I keep getting GET/200, copy fees.

    However, delete the "disable cache" to speed things up and the server and the client negotiate and check if she even needs to send you the document (if she thinks she's changed), and if not, of course you GET/304, or "load cache:

    Whenever I update I get GET/304, hitting the cache.

    Make sure your requests are GET/200 if you expect not to be cached.

  • Im having trouble with the color on my xbox

    I have problems with the color on my xbox since I did an update, as well as I was updating a pop up was held to let me watch the first of the new game black ops, the color is off and I can't play my game like this. What can I do about it?

    Hello

    Answers has no influence on the XBox or XBox Live must
    contact with them.

    XBox - Support
    http://support.Xbox.com/en-us/pages/default.aspx

    XBox - Contact us (support)
    http://support.Xbox.com/en-us/contact-us

    XBox - Support Forums - and my XBox (top-right)
    http://forums.Xbox.com/

    Xbox technical support phone number

    • Toll-free: (800) 4MY-XBOX or (800) 469-9269

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • Anyone having trouble with the last update. Does not load on any machine

    Title says it all

    Well, well, well. It seems that I have to answer my own question.

    I downloaded the patch from www.adobe.com/support/downloads/product.jsp?product=1&platform=Windows

    He also wanted to stop with the same error but, unlike the update of the program, I got an option ignores. On the basis, that I couldn't be in a worse place, I took this option and it worked!

    Maybe something wrong with the patch?

    David

  • Is anyone having trouble with the header does not stay and he jumps back?

    After this last update of Mozilla Firefox my head with persona disappeared. After placing my cursor at the top of the screen it suddenly came back but on a part of it and you can't see my character lighthouse, I chose previously.

    You are welcome.

  • Im having trouble with the pressure on the calligraphic brush on my illustrator. If it is not included in the trial version? Thank you

    maroon.png

    Hi Noel,

    Pressure of the brushes in artificial intelligence is related to the entrance of the devices that support of pressure. So if you need to use pressure with your laptop, you can buy Wacom intuos tablets or can be buy an external monitor supporting pressure.

    Sanjay.

  • Having trouble with the installation of the printer?

    Hi, I bought the Premium C410B photo all in one printer, but after trying so many times I can't still manage to install all the software for it. Fax does not work, the Hp Solution Center does not work. I even rebooted my system. I don't see the fax printer in the control Panel\Hardware and Sound\Printers page. I tried HP diagnostics as well, also downloaded latest software Web site. Still no luck.

    Help, please

    Thanks for the help I ended up by format the pc now it works.

  • I have Windows vista and I am trying to implement a p1000 hp photosmart printer but having trouble with the drivers

    E-mail address is removed from the privacy *.

    Make sure you have Windows (32-bit or 64) and download the driver for an hp website.

    Do not connect the printer when you are asked to do.

    Good luck.

    Higher than http://www.computerstar.ca/ tech

  • Newbie - having trouble with the background color when you open new document

    Hey everybody and thanks for the help in advance. New to the Forum and have not been able to find the answer online. Everytime I open Photoshop (using Adobe Creative Cloud) I set my size, my background to white, etc.. The document opens always look like this: http://screencast.com/t/BzCYc4akl

    Almost as if it is transparent, but I have not selected. Can someone help here? Thank you!

    Hello

    Looks like that the gates are activated.

    If in photoshop, you go to view > Show and click on the word grid, does make a difference?

  • Still having trouble with the Adobe viewer

    I always feel the question when I have several objects of State (State 1 is off the page, State 2 is on the page) the hidden state (State 2) appears on the Adobe viewer iPad when you click on the | icon in the menu at the top left. In the decorative Panel to the creator 'tap to play/pause' is not checked.  "Cross Fade" and "Hide before playing" is checked.

    Any help would be appreciated!  Thank you!

    What I was able to determine: oject to the containing all States.  The State where there is no object in view must appear first. (any number of State it is, just need to be first in the list)  When I did it for my MSO there was no problem viewing!  Please point me in the right direction. much appreciated!

  • Trouble with the Satellite Pro L300 Ethernet controller driver

    Hello

    I bought a Toshiba Satellite Pro L300 Model (PSLB9A - 064022)

    Put XP Pro/SP2-Having trouble with the Ethernet controller driver.

    I downloaded the driver from the appropriate list (Toshiba support) only network via another PC memory = car lappy

    Realtek_LAN_56861032008_XP.exe

    install
    installed in a folder named c:\ "DELL"-(WHICH can not be move?)
    drivers R86360
    OF this dossier, I do the "setup."

    broad com 440 x - installs as everything is good,
    made just TWO yellow controllers.in etha...
    \
    but isn't she suppose to be integrated realtek 10/100 Mbit / s Ethernet TX.

    Can someone please point me in the right direction.

    Thanks in advance...

    Steve

    Hello

    It seems that the Australian model, try this one:

    http://file.MyToshiba.com.au/file/Download/Resource/File/13002/Realtek_LAN_56861032008_XP.exe

  • Im having trouble with my iphone 16 GB ios 9.3.3 5s (G 13, 34) receive error code 22 tries to connect to the server, and nowhere suggestions?

    Im having trouble with my iphone 16 GB ios 9.3.3 5s (G 13, 34) receive error code 22 tries to connect to the server, and nowhere suggestions? I have tried almost everything turn power switch wifi in the middle and doing it to try to track down the problem in the Device Manager and im completely disgusted

    Have you tried turning off and back on again?

  • Hello, I recently bought a new iMac and I am wanting to install Lightroom for her, but I'm having some trouble with the key to series is not recognized. There is no disk drive on the new Mac, so I can't just pop the disc in. Is there anyway I

    Hello, I recently bought a new iMac and I am wanting to install Lightroom for her, but I'm having some trouble with the key to series is not recognized. There is no disk drive on the new iMac, so I can't blow my disc. Is there a way I can download it simply by using the key to series on my package? I tried the section "Redeem Code", but said air key is not valid. Thank you

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a way to go to a page to download the Adobe programs if you do not have a disk or drive

    -Cloud desktop http://helpx.adobe.com/creative-cloud/help/creative-cloud-desktop.html

    -Cloud Getting Started https://helpx.adobe.com/creative-cloud.html

    -you will need to enter your original serial number during the installation for non-Cloud programs

    - or kglad links in response to #1 here can help https://forums.adobe.com/thread/2081216

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

  • Trouble with the pivot and the columns that contain numbers/spaces

    Hello

    I have trouble with the pivot statement.
    How could I do this just for columns that are numbers?
    How could I do this just for columns that contain spaces?

    Can someone please help?


    based on the documentation of Carsten Czarski
    http://SQL-PLSQL-de.blogspot.com/2007/08/kreuztabellen-in-Oracle11g-SQL-pivot.html

    essentially to help:
    --------------------
    Select deptno, sum (clerk), sum (salesman), sum (manager)
    of (emp) pivot
    Sum (SAL) of EMPLOYMENT
    in ("CLERK" as a 'CLERK', 'SELLER' as 'SELLER', 'MANAGER' as 'MANAGER')
    )
    Deptno group
    --------------------
    DEPTNO SUM (CLERK) SUM (SALESMAN) SUM (MANAGER)
    ---------- ---------- ------------- ------------
    30 950 5600 2850
    20 1900 2975
    10-1300-2450



    I tried to run at my own table:

    NAME MONAT WERT
    -------------------------------------------------- ---------- ----------
    5 Antarctica 404,84
    Asia 7 106,41
    Oceana 2 456,96
    4 the Europe 426,23
    9 Antarctic 537,56
    Europe 9 832,58
    The South America 12 662,41
    Europe 4 422,27
    America of the North 7 312,19
    America of the North 10 148,92

    10 selected lines.


    But running:
    --------------------
    SELECT name, sum (1), sum (2), sum (3), sum (4), sum (5), sum (6), sum (7), sum (8), sum (9), sum (10), sum (11), sum (12)
    (pivot) apex_wksp.demo_pivot2
    Sum (Wert) for monat
    in ('1 ', '2', ' 3', '4 ', '5', '6', '7',' 8 ', ' 9',' 10', ' 11 ', ' 12')
    )
    Group by name
    ;
    --------------------
    led to:
    Antarctica 1 2 3 4 5 6 7 8 9 10 11 12
    North America 1 2 3 4 5 6 7 8 9 10 11 12
    Oceana 1 2 3 4 5 6 7 8 9 10 11 12
    The South America 1 2 3 4 5 6 7 8 9 10 11 12
    Europe 1 2 3 4 5 6 7 8 9 10 11 12
    Asia 1 2 3 4 5 6 7 8 9 10 11 12
    6 selected lines.


    not quite what I expected.





    In addition,
    --------------------
    Select monat, sum (Antarctica), sum (North America), sum (Oceana), sum (South America), sum (Europe), sum (Asia)
    (pivot) apex_wksp.demo_pivot2
    Sum (Wert) name
    ("Antarctic", "North America", "Oceana", "South America", "Europe", "Asia")
    )
    Group by name
    ;
    ---------------------
    ORA 907 results



    I know what the problem is - but how do I do it right?


    using double quotes or replace (ing) space with just underscores seems to garble sql for the unreadable.




    Help, please.



    Thanks in advance,
    Michael Weinberger

    Attention to the rotated default column alias:

    SQL> with demo_pivot2 as (
      2                       select 'Antarctica' name,5 monat,404.84 wert from dual union all
      3                       select 'Asia',7,106.41 from dual union all
      4                       select 'Oceana',2,456.96 from dual union all
      5                       select 'Europe',4,426.23 from dual union all
      6                       select 'Antarctica',9,537.56 from dual union all
      7                       select 'Europe',9,832.58 from dual union all
      8                       select 'South America',12,662.41 from dual union all
      9                       select 'Europe',4,422.27 from dual union all
     10                       select 'North America',7,312.19 from dual union all
     11                       select 'North America',10,148.92 from dual
     12                      )
     13  select name, sum("'1'"),sum("'2'"),sum("'3'"),sum("'4'"),sum("'5'"),sum("'6'"),sum("'7'"),sum("'8'"),sum("'9'"),sum("'10'"),sum("'11'"),sum("'12'")
     14  from demo_pivot2 PIVOT (
     15  sum(wert) for monat
     16  in ('1','2','3','4','5','6','7','8','9','10','11','12')
     17  )
     18  group by name
     19  ;
    
    NAME          SUM("'1'") SUM("'2'") SUM("'3'") SUM("'4'") SUM("'5'") SUM("'6'") SUM("'7'") SUM("'8'") SUM("'9'") SUM("'10'") SUM("'11'") SUM("'12'")
    ------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ----------- -----------
    Antarctica                                                    404.84                                      537.56
    North America                                                                       312.19                            148.92
    Oceana                       456.96
    South America                                                                                                                                 662.41
    Europe                                              848.5                                                 832.58
    Asia                                                                                106.41
    
    6 rows selected.
    
    SQL> 
    

    SY.

Maybe you are looking for

  • The speaker lite does not work

    Everything works but the light does not indicate its is. The speaker lite does not function although the button is on switch its market? Dv6 - 6033cl

  • BlackBerry Z30 unable to use Z30

    Hello I stuck little after using my Z30 for 4 days. I have purchase Z30 ST100-2 of the Amazon India. I am based in hyderabad. This all started when I upgraded my Z30 successfully with the worm 10.3.2.xxxx. Everything was fine, but I was regularly get

  • Future applications and Windows RT

    Hi guys,. Applications added to the app store for Windows is not compatible with Windows RT? That is to say. When Spotify wrote and released an app for the store will be able to use it on my surface with RT? Thank you! James

  • Chande color on a picture of the object

    change the color on a topic on photo

  • Scaling of Compositions

    Hey! I started to revolve around Adobe Muse this week and I built a site.  I'm trying to get an effect similar to that on the homepage of Walt Disney Animation Studios: Walt Disney Animation StudiosAs on the Disney site, I have a header and a footer