LMS 3.2 Compliance Template syntax help

I want to add the command "no logging event link-status" to all switchport mode access ports EXCEPT for the ones with the following switchport access vlans: 4022,4032,4042,4052,4072 & 4082. How do I create a compliance template to do this?
LMS 3.2, RME 4.3.1

Tried it & it didn't work. Here is a sample config of the ports. Command should not deploy on ports fa1 & 3 & gi1 but should deploy on fa2,4-8.
interface FastEthernet0/1
description NetOps Data/VoIP
switchport access vlan 4082
switchport mode access
switchport nonegotiate
switchport voice vlan 4083
snmp trap mac-notification change added
spanning-tree portfast
ip dhcp snooping trust
interface FastEthernet0/2
description NetOps Data/VoIP
switchport access vlan 661
switchport mode access
switchport nonegotiate
switchport voice vlan 4083
snmp trap mac-notification change added
spanning-tree portfast
interface FastEthernet0/3
switchport trunk encapsulation dot1q
switchport mode trunk
switchport nonegotiate
spanning-tree portfast trunk
spanning-tree bpduguard disable
ip dhcp snooping trust
interface FastEthernet0/4
description NetOps Data/VoIP
switchport access vlan 661
switchport mode access
switchport nonegotiate
switchport voice vlan 4083
ip access-group POLICY in
authentication order dot1x mab webauth
authentication port-control auto
authentication fallback WEB_AUTH_PROFILE
mab
snmp trap mac-notification change added
no snmp trap link-status
dot1x pae authenticator
dot1x timeout tx-period 5
no lldp transmit
spanning-tree portfast
interface FastEthernet0/5
description NetOps Data
switchport access vlan 661
switchport mode access
switchport nonegotiate
interface FastEthernet0/6
description NetOps Data/VoIP
switchport access vlan 661
switchport mode access
switchport nonegotiate
switchport voice vlan 4083
snmp trap mac-notification change added
spanning-tree portfast
interface FastEthernet0/7
description VoIP Phone 43170
switchport access vlan 661
switchport mode access
switchport nonegotiate
switchport voice vlan 4083
snmp trap mac-notification change added
interface FastEthernet0/8
description Docking Station
switchport access vlan 661
switchport mode access
switchport nonegotiate
switchport voice vlan 4083
snmp trap mac-notification change added
interface GigabitEthernet0/1
description Feed from c3750uhs011a fa3/0/30
switchport trunk encapsulation dot1q
switchport mode trunk
switchport nonegotiate
rmon collection history 10101 owner campusmanager buckets 10 interval 300
spanning-tree portfast trunk
spanning-tree bpduguard disable
ip dhcp snooping trust

Similar Messages

  • LMS 4.2.3 baseline compliance template and standard ACL

    When using a baseline compliance template to check and deploy a standard ACL, I encountered what seems to be a bug:
    I configured a template with these commands:
    +ip access-list standard 21
    +; Hosts allowed access
    +  permit host 10.20.30.40
    +  permit host 40.30.20.10
    +  deny any log
    When I do compliance check and deployment, the last line is dropped by LMS.
    In fact, when I look into the job's "Work Order", the commands are:
    ip access-list standard 21
    ; Hosts allowed access
      permit host 10.20.30.40
      permit host 40.30.20.10
    After the job run, "show running-config" shows the access list matching the "Work Order" (without the "deny any log" command.)
    Is this a bug?

    Doesnt have any issues on my Lab 4.2.4. following is the Job Work order :
    Name:
    Archive Mgmt Job Work Order
    Summary:
    General Info
    JobId: 2704
    Owner: admin
    Description: test_acl
    Schedule Type: Immediate
    Job Type: Compliance Check
    Baseline Template Name: test_acl
    Attachment Option: Disabled
    Report Type: NAJob Policies
    ----------------------------------------------------------------------------------------------E-mail Notification: Not Applicable
    Job Based Password: DisabledDevice Details
    Device
    Commands
    Sup_2T_6500
      ip access-list standard 21
      permit host 10.20.30.40
      permit host 40.30.20.10
      deny any log
    10.104.149.180
      ip access-list standard 21
      permit host 10.20.30.40
      permit host 40.30.20.10
      deny any log
    Check your template, or export it and share, i will try it on my LMS server. also, check the same complaince job on other devices if you have such issues.
    -Thanks
    Vinod
    **Rating Encourages contributors, and its really free. **

  • RME compliance template question

    Using LMS 3.2, I've started learning how to use the compliance templates. I have a question regarding the regex matching, and I can't seem to find
    an answer in the docs or in the forum posts. I do admit that I have not dug real deep in the forums.
    My question is: is there a regex to ignore case? For instance, if I have the line:
    clock timezone est -5           in some configs, and
    clock timezone EST -5          in others
    is there a way to tell the template that upper case and lower case are acceptable matches?
    Thanks for any help - chris

    ok, I got a handle on how the regexes work. It took about 6 or 7 edits of the template but I finally did get it right. fyi, for the above example, the template would look like:
    +clock timezone [#est|EST#] -5
    chris

  • Compliance Template

    I'm trying to setup and compliance template to check and deploy a configuration change based upon the following criteria
    All Switches, any fastethernet interface with a interface description containing the string "bmg" should have the command no snmp trap link-status.
    anbody help please??

    I want to do something very similar to this.  I need to add the logging event link-status command to any interface that has a description that begins with LWAP:
    This example seems to suggest 2 separate templates.  Are these 2 Advanced templates?  The example in the help file suggests Command Sets within one template.  Any guidance would be appreciated, thanks.

  • Syntax help

    hi friends
    i need the syntax help for the below sentence
    F = (10 - (round(10 - j) - j)^2)
    this is giving error in editor
    pls help to resolve this
    thanks in advance
    with regards
    s.janagar

    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(UID) TYPE  OIJNOMI-ZZSCHEDID
    *"     REFERENCE(TIMESTAMP) TYPE  CHAR14
    *"  EXPORTING
    *"     REFERENCE(TOKEN) TYPE  CHAR25
    *timestamp (YYYYMMDDhhmmss)
      DATA: zyear TYPE i,
            zmon TYPE i,
            zdat TYPE i,
            zhrs TYPE i,
            zmin TYPE i,
            zsec TYPE i,
            zfrm TYPE i,
            zuid TYPE i,
            a TYPE i,
            b TYPE i,
            c TYPE i,
            d TYPE i,
            e TYPE i,
            f TYPE i,
            g TYPE i,
            h TYPE i,
            i TYPE i,
            j TYPE i,
            k TYPE i,
            w_data  TYPE i.
    splitting up the timestamp to date,month,hrs,minutes etc.,
      zuid = uid.
      zyear = timestamp+0(4).
      zmon = timestamp+4(2).
      zdat = timestamp+6(2).
      zhrs = timestamp+8(2).
      zmin = timestamp+10(2).
      zsec = timestamp+12(2).
      a = zhrs + 1.
      b = zuid - zdat + zhrs.
      c = zyear - zhrs.
      d = zmin + zuid .
      e = zyear + zhrs * 13 + zuid + zdat * 23 .
      f = e * zuid.
      g = zuid - zdat.
      h = zuid - zhrs.
      i = zhrs - zdat.
      j = zuid / 10.
      k = 25 - zhrs.
      zfrm = ABS( 15 * zuid * a + 11 * b + 19 * c + d * 3 + f + zhrs * zhrs * g * h + i * 23 * ( 10 - ( j - round( j ) * 10 ) exp 2 ) * ( k ) exp 2 ).
      token = zfrm.
    Edited by: janagar sundaramoorthy on Nov 25, 2008 9:20 AM

  • Template Syntax

    hello , i have a small problem with template syntax . i'm trying to construct a chained list in which i add a new element at its end when i use function PUSH and eliminate the first element when i use function POP .
    class Complex {
    int a; int b;
    Complex next;
    public Complex(int x,int y) { a=x; b=y; }
    //public String toString{ String q=new String(); q=a+" "+b+"i"; return q; }
    public boolean equals(Object b)
                    { Complex t=(Complex)b;
                      return t.a==a&&t.b==b; }
    class Lista <T> {
    T vf; T sf;
    void push(int a,int b)
            { if(vf!=null) { T y=new T(a,b);  sf.next=y; sf=y; }
                     else { vf=new T(a,b); sf=vf; }
    public T pop()
    { T y; y=vf; vf=vf.next; return y; }
    class Main
    { public static void main(String agr[])
    { Lista<Complex> List=new Lista<Complex>();
      List.push(3,4);   List.push(3,5);   List.push(3,6);
    System.out.println(List.pop()+" "+List.pop()+" "+List.pop());
    }The problem apears in the push and pop function ; the compiler doesn't understand when i declare a new element , like when i use : T y=new T(a,b);What is the syntax for this case ?

    badescuga wrote:
    so how can i initiate an element of a generic typeWhat do you mean by "initiate"? Do you mean "instantiate"? If so: you can't with the information you have in your example.
    You could require a Class object as argument that has the correct type (i.e. Class<? extends T>), store that and call newInstance() on that to create a new object.
    and then implement the desired value ?What exactly do you mean by "implement" here? I don't think it means what you think it means.
    The word "implement" is often mis-used by beginners.
    To "implement" something means simply to write code that does that thing. It doesn't mean anything else ({noformat}*{noformat}). It does not mean "to call a method". It does not mean "to instanciate an object".
    ({noformat}*{noformat}) at least not in this context

  • I have created several templates and they look great in live view, however they look like crap when actually tried to set up a webpage based on the template. Help!

    I have created sevedral templates and they look great in the live view, however they look like plain HTML text when I try to create a webpage based on the template. HELP!

    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • LMS 3.1 Assistance with compliance template

    I need to add the logging event link-status command to any interface that has a description that begins with LWAP
    This is what I have, but it does not work:
    Name: Global     SubMode: No                             isPrerequisite: No                       
    Ordered : No                               Prerequisite-Commandset : none                               Parent: none                            
    Name: CheckDescr     SubMode: Yes                             isPrerequisite: Yes                       
    Ordered : No                               Prerequisite-Commandset : none                               Parent: Global                            
       interface  [#GigabitEthernet.*#]
    #To check for existence of command enter
       + [#description    .*LWAP.*#]                                                                                                                                
    Name: AddLoggingEventLinkStatus     SubMode: No                             isPrerequisite: No                       
    Ordered : No                               Prerequisite-Commandset : CheckDescr                               Parent: CheckDescr                            
       + logging event link-status
    Thanks for any help.

    Looks like a problem with virus scanning on the server side.  Here are the contents of the template:
    <?xml version="1.0" encoding="UTF-8"?>
          [#description .*WLAN.*#]
        interface [#FastEthernet.*#]
            logging event link-status
          CheckDescr

  • LMS 4.2 Compliance check extended access-list

    Hi,
    I would like to check of our router has one specific line in an extended access-list. I have tried to use the 'baseline compliance' to get the output, but can't get the syntax right.
    I would like to avoid checking on the line number in the access-list, because this is not the same on all the routers.
    I have made a new compliance check like this:
    'submode': ip access-list extended 'acl-name'
    +deny tcp any any eq smtp
    But that is not working, Can some one show me the 'right path'?
    Thanks
    Soren                 

    Doesnt have any issues on my Lab 4.2.4. following is the Job Work order :
    Name:
    Archive Mgmt Job Work Order
    Summary:
    General Info
    JobId: 2704
    Owner: admin
    Description: test_acl
    Schedule Type: Immediate
    Job Type: Compliance Check
    Baseline Template Name: test_acl
    Attachment Option: Disabled
    Report Type: NAJob Policies
    ----------------------------------------------------------------------------------------------E-mail Notification: Not Applicable
    Job Based Password: DisabledDevice Details
    Device
    Commands
    Sup_2T_6500
      ip access-list standard 21
      permit host 10.20.30.40
      permit host 40.30.20.10
      deny any log
    10.104.149.180
      ip access-list standard 21
      permit host 10.20.30.40
      permit host 40.30.20.10
      deny any log
    Check your template, or export it and share, i will try it on my LMS server. also, check the same complaince job on other devices if you have such issues.
    -Thanks
    Vinod
    **Rating Encourages contributors, and its really free. **

  • CiscoWorks and Parameterized templates ERROR - Help Joseph:-)

    Hi,
    I am using CiscoWorks RME 4.3.1 I am trying to use Parameterized templates as explained in this document:
    http://www.cisco.com/en/US/docs/net_mgmt/ciscoworks_resource_manager_essentials/4.3/user/guide/netcfg.html
    Here is my XML file located in the right place: NMSROOT\files\rme\netconfig\cmdFileson the CiscoWorks server:
    <DEVICE NAME = 10.60.131.1>
    <CMDPARAM NAME = ConfigFile>
    <value>TST4CUPE10-Confg-PV.txt</value>
    </CMDPARAM>
    </DEVICE>
    Then in RME I creat a user-defined task  as the one you can see there:
    Then I create a new job on a device with the parameterized file:
    Actually if I put a tick in the Check Syntax I got the following error message:
    I don't understand as the value is configured in the xml file as you can see above!
    When the job is done I get a status: successful:
    But the problem is that nothing has changed on the device cause of the following error:
    configure replace bootflash:$ConfigFile force
    Error: Could not open file bootflash:$ConfigFile for reading
    Here is the result on the screen:
    Does anyone knows what could cause this error?
    Best regards,
    Laurent

    Hi Joe,
    I have a good news. It is working now after I changed the IP to the hostname as you suggested.
    But it was not working even with the hostname because I had a “<” too much.
    bootflash:TST4CUPE10-Confg-PV.txt<
    So now the file look like that:
    bootflash:TST4CUPE10-Confg-PV.txt
    Thank you so much for your help! That is fantastic
    Best Regards,
    Laurent

  • SELECT statement in FROM clause - syntax help

    Hi,
    I want to have a SELECT statement in the FROM clause. I get syntax error when doing this and since I am new to ABAP I need som help.
    I want to do the following, (and if anyone has any SELECT statement from their own system which you know there is no syntax error in please post it here so I can analyze the syntax):
    *I leave the INTO itab clause out, since I only want to demonstrate the functionality
    I am trying to get.
    <b>SELECT</b> tableOne~someField
    <b>FROM</b> tab <b>AS</b> tableOne (<b>SELECT</b> someField
                                         <b>FROM</b> tab
                                         <b>WHERE</b> someFiled > 1) <b>AS</b> tableTwo
    <b>WHERE</b> tableOnesomeField > tableTwosomeField
    like I said, the problem is that the select statement in the parenthesis in the from clause seems to be incorrect because I get "wrong expression" when trying to compile. Is this because I cannot have a select statement in the from clause or is it because of a minor syntax error, such as I forgot a dot, or some other sign?
    thanks and regards
    Baran

    sorry i am not enough familiar with sub queries but some error i can see which i will state here.
    1> you have to use sub queries i.e. select in ( ) after where clause because here you are fulfilling a where clause by another select statement.
    like this
    SELECT * FROM SFLIGHT
        INTO WA
        WHERE SEATSOCC = ( SELECT MAX( SEATSOCC ) FROM SFLIGHT ).
    2> you cannot specify field name without into clause either you have to use
    select *  or select f1 into tab-f1  like this...
    but if you are using select * without into you have to define
    tables : dbtab.
    selec * from dbtab. like that.
    regards
    shiba dutta

  • Problem with dreamweaver template please help!!

    I need to update the navigation links of a website, which has about 30 pages, and they all use a master.dtw template file, I did not create the website, somebody else did, what i did was downloaded it to my computer from the server, which includes the master.dtw file, the problem is that when I finish downloading the website, dreamweaver does not recognize the master.dtw as a template, if i modify the template file and save it, it wont update all the webpages that it is using the template, what I do is I go to the assets tab, right click, and press update site, it updates all pages, but I loose the styling in most pages, I have been trying different things and nothing seems to work, is there anything I can do to easily update the website from the template file without loosing the styling?
    thanks

    If you provide a code of your template or better a link where people can see your template then you will get a helpful reply here.  You have to understand that without the code, people would be chasing a wild goose!
    hth

  • Using Spry in Templates - please help!

    I am trying to use Spry in templates (Dreamweaver CS4) and
    cannot do it. Can someone please help me? I know that I can put the
    spry widget inthe template but then it will be on every child page
    which I don't want. I'm not sure I understand the instructions to
    open the head...
    -Josh

    > I dont understand about opening a head...
    I think it has something to do with transcendental
    meditation....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "GPaul" <[email protected]> wrote in message
    news:glf037$ae7$[email protected]..
    > Im not sure I understand your question, however if you
    dont want something
    > in every child page of a template, then you put it in an
    editable section
    > on the child pages you do watn, or make that section
    editable and take out
    > on the pages that you dont want it on.
    >
    > I dont understand about opening a head...
    >
    >
    > "jl25" <[email protected]> wrote in
    message
    > news:gldsbb$79$[email protected]..
    >>I am trying to use Spry in templates (Dreamweaver
    CS4) and cannot do it.
    >>Can
    >> someone please help me? I know that I can put the
    spry widget inthe
    >> template
    >> but then it will be on every child page which I
    don't want. I'm not sure
    >> I
    >> understand the instructions to open the head...
    >>
    >> -Josh
    >>
    >
    >

  • Syntax help needed in update using 'WITH' Clause

    Update     CP_JP_CORP_FSASA_FEEDUPLOAD_r r
                             set     (
                                   gfrn,                              
                                   tenor_code,
                                   tenor_description,
                                   exposure_category,          
                                   frr,          
                                   facility_classification,
                                   limit_amount,
                                   limit_usd,
                                   approval_ccy,
                                   approval_date,
                                   expiry_date,
                                   avail_status_code,
                                   avail_status_desc,
                                   revolving_indicator,
                                   committed_flag,
                                   committed_until_date,
                                   committed_amount,
                                   advised_flag,
                                   advised_amount,
                                   facility_long_description,
                                   booking_unit_code,
                                   extending_unit_code,
                                   extending_unit_short_desc,
                                   approving_unit_code,
                                   approving_unit_short_des,
                                   transaction_type,
                                   branch_no
                                   =
                                            With t as
                                                 Select     fac.gfrn,fac.tenor_code,fac.tenor_description,fac.exposure_category,fac.frr,
                                                      fac.facility_classification,fac.limit_amount,fac.limit_usd,fac.approval_ccy,
                                                      fac.approval_date,fac.expiry_date,fac.avail_status_code,fac.avail_status_desc,
                                                      fac.revolving_indicator,fac.committed_flag,fac.committed_until_date,fac.committed_amount,
                                                      fac.advised_flag,fac.advised_amount,fac.facility_long_description,fac.booking_unit_code,
                                                      fac.extending_unit_code,fac.extending_unit_short_desc,fac.approving_unit_code,fac.approving_unit_short_des,
                                                      /*'Check' normalflag,
                                                      cust.adjusted_orr fsasaorr1stborrower,
                                                      'Normal' category1stborrower,
                                                      cust.adjusted_orr fsasaorr2ndborrower,
                                                      'Normal' category2ndborrower,
                                                      cust.adjusted_orr fsasaorrfinal,
                                                      'Normal' categoryfinal */
                                                      txn.transaction_type,txn.branch_no,txn.gfcid,txn.transaction_id
                                                 from     cp_fsa_boj_corp_cr_fac_hist fac,
                                                           --cp_fsa_boj_corp_cr_cust_hist cust,
                                                           cp_fsa_boj_corp_cr_txn_hist txn
                                                 where     fac.gfcid = txn.gfcid
                                                           and fac.facility_id = txn.facility_id
                                                           and fac.as_of_date = txn.as_of_date
                                                           and to_char(fac.as_of_date,'yyyymm') = p_financial_period
                                                           and fac.as_of_date = last_day(fac.as_of_date)
                                            select      t.gfrn,
                                                      t.tenor_code,
                                                      t.tenor_description,
                                                      t.exposure_category,
                                                      t.frr,
                                                      t.facility_classification,
                                                      t.limit_amount,
                                                      t.limit_usd,                                             
                                                      t.approval_ccy,                                             
                                                      t.approval_date,                                             
                                                      t.expiry_date,                                             
                                                      t.avail_status_code,                                             
                                                      t.avail_status_desc,                                             
                                                      t.revolving_indicator,                                             
                                                      t.committed_flag,                                             
                                                      t.committed_until_date,                                             
                                                      t.committed_amount,                                             
                                                      t.advised_flag,                                             
                                                      t.advised_amount,                                             
                                                      t.facility_long_description                                             
                                                      t.booking_unit_code,                                             
                                                      t.extending_unit_code,                                             
                                                      t.extending_unit_short_desc,                                        
                                                      t.approving_unit_code,                                             
                                                      t.approving_unit_short_des,                                             
                                                      t.transaction_type,
                                                      t.branch_no
                                            from     t
                                       where      r.financialperiod           = p_financial_period
                                                 and exists
                                                           Select     1
                                                           from     t
                                                           where     t.transaction_id = r.ce_trans_id
                                                      )I'm facing syntax problem

    Hii All,
    This is my actual update.(I stopped performing dml operations in cursors following Karthick Arp) :-)
    Update     CP_JP_CORP_FSASA_FEEDUPLOAD_r r
                             set     (
                                   gfrn,                              
                                   tenor_code,
                                   tenor_description,
                                   exposure_category,          
                                   frr,          
                                   facility_classification,
                                   limit_amount,
                                   limit_usd,
                                   approval_ccy,
                                   approval_date,
                                   expiry_date,
                                   avail_status_code,
                                   avail_status_desc,
                                   revolving_indicator,
                                   committed_flag,
                                   committed_until_date,
                                   committed_amount,
                                   advised_flag,
                                   advised_amount,
                                   facility_long_description,
                                   booking_unit_code,
                                   extending_unit_code,
                                   extending_unit_short_desc,
                                   approving_unit_code,
                                   approving_unit_short_des,
                                   transaction_type,
                                   branch_no
                                   = (          
                                       Select     fac.gfrn,fac.tenor_code,fac.tenor_description,fac.exposure_category,fac.frr,
                                            fac.facility_classification,fac.limit_amount,fac.limit_usd,fac.approval_ccy,
                                            fac.approval_date,fac.expiry_date,fac.avail_status_code,fac.avail_status_desc,
                                            fac.revolving_indicator,fac.committed_flag,fac.committed_until_date,fac.committed_amount,
                                            fac.advised_flag,fac.advised_amount,fac.facility_long_description,fac.booking_unit_code,
                                            fac.extending_unit_code,fac.extending_unit_short_desc,fac.approving_unit_code,fac.approving_unit_short_des,
                                            txn.transaction_type,txn.branch_no
                                       from     cp_fsa_boj_corp_cr_fac_hist fac,
                                                 --cp_fsa_boj_corp_cr_cust_hist cust,
                                                 cp_fsa_boj_corp_cr_txn_hist txn
                                       where     fac.gfcid = txn.gfcid
                                                 and fac.facility_id = txn.facility_id
                                                 and fac.as_of_date = txn.as_of_date
                                                 and to_char(fac.as_of_date,'yyyymm') = p_financial_period
                                                 and fac.as_of_date = last_day(fac.as_of_date)
                             where Exists
                                                 Select     1
                                                 from     cp_fsa_boj_corp_cr_fac_hist fac,
                                                           cp_fsa_boj_corp_cr_txn_hist txn
                                                 where     fac.gfcid = txn.gfcid
                                                           and fac.facility_id = txn.facility_id
                                                           and fac.as_of_date = txn.as_of_date
                                                           and to_char(fac.as_of_date,'yyyymm') = p_financial_period
                                                           and fac.as_of_date = last_day(fac.as_of_date)
                                                           and txn.transaction_id = r.ce_trans_id
                                            )Now in my update I'm using same 'SELECT' twice once in 'SET' and again in 'EXISTS' clause. I'd like to make use of 'WITH' Clause and avoid unnecessary 'SELECT' . Please help me.

  • PL/SQL Function Syntax help please...

    Can someone help me with the syntax here please? I am sure i am doing something wrong in my LOOP.
    create or replace FUNCTION fcn_chk_dec(p_date number)
    return NUMBER
    as
    --DECLARE
    v_date NUMBER;
    v_active NUMBER;
    v_prev NUMBER;
    v_delta NUMBER;
    v_perc_delta NUMBER:
    CURSOR c_prev_active IS
         select date,people,
    lag(people,1) over (order by date)
         from stats
    where date between to_date(p_date, 'YYYYMMDD')-2 and to_date(p_date, 'YYYYMMDD')-1
         order by date desc
    BEGIN
         OPEN c_prev;
    loop
         FETCH c_prev INTO v_date,v_active,v_prev;
         exit when c_prev%NOTFOUND;
         v_delta:=v_active-v_prev;
    v_perc_delta:=trunc((v_delta/v_active*100),2)
    end loop;
    close c_prev;
    return v_perc_delta;
    END fcn_chk_dec;

    what i am trying to do is create a funtion that will return one value for the first row that comes back.
    here is my initial query. the reason i did not go with this query is because there are too many selects and i was told that's not good and slows down the system. Plus, i need to have a function call in another program that will access this function to compare it's output to a value in a table.
    here was my initial start:
    select date,people,delta,trunc((delta/people*100),2) as perc_delta
    from (select date, people,people-prev_dly_people as delta
    from
    (select date,people,
    lag(people,1) over (order by date) as prev_dly_people
    from stats
    where date between to_char(sysdate-2,'YYYYMMDD') and to_char(sysdate-1,'YYYYMMDD')
    order by date desc))
    basically, i have a table that has a total number of people. I want to get the percentage growth and decline from the most recent date and the date before it. This will give me a day to day percentage of people population change as of the most recent date.
    I need this to be a function becaus i want to be able to pass any date i want into it and get the given delta percentage at the time for the people's population.
    hope this makes sense.

Maybe you are looking for

  • Receiver File Adapter error

    Hi all, I am trying to convert the XML to Plain file in receiver file adapter. I am using module - StrictXml2PlainBean My target structure is - <MT_Name>     <records>         <Header>         </Header>         <Item>         </Item>     </records> <

  • Safari is not allowing Adobe Acrobat to control PDF viewing, PDFs are opening in Preview

    After the latest update of Safari, in Snow Leopard, when I attempt to open a document as a PDF, the document is opening in Preview rather that Adobe Acrobat software.  This has never happend before.  I have been openning PDFs in Acrobat in every prev

  • Why does the window flash upon highlighting a link?

    I spend a good amount of my time in half-window for firefox (Windows 7) There is flashing on the sides of the window (glass) whenever I highlight a link. That is a poor description. See the change in the pictures not hovering over a link http://img.p

  • Need a XP pro person help!!

    Need exact path to put my ringtones in and music so everything will sync !! It should be something like this: = C:\Documents and Settings\Name\Application Data\Apple Computer

  • Publishing a podcast

    Hi everyone, After upgrading to Yosemite, Podcast Maker 1.4.1 no longer works. There is no support for this product as the developer site seems to be let go. I was wondering if anyone has any other suggestions on software we can use to generate the r