Conditional SQL?

Is there a way to write a piece of pure SQL (no PL/SQL allowed!) which will conditionally execute a query or not.
Something like
select case when count(*) = 1 then (select * from dba_objects) else null end from my_table;...that is, count the records in MY_TABLE, and if there is one record in there, then select from dba_objects. If there are 0 or 2 or more records, then don't do anything.
Obviously this is easy to do in PL/SQL... but I would like to know if it is at all possible in SQL alone (let's assume version 10 upwards)
If there isn't, then that's fine as an answer, too!

Perhaps doing it along these lines will do what you want (I've done the conditional bit slightly different for demonstration purposes)...
SQL> with t as (select case when count(*) = &cnt_chk then
  2                      xmltype(dbms_xmlgen.getxml('select empno
  3                                                        ,ename
  4                                                        ,job
  5                                                        ,mgr
  6                                                        ,to_char(hiredate,''YYYY-MM-DD'') as hiredate
  7                                                        ,sal
  8                                                        ,comm
  9                                                        ,deptno
10                                                  from emp'
11                                                 )
12                             )
13                    else
14                      xmltype('<ROWSET/>')
15                    end as xml
16             from dual
17            )
18  select x.*
19  from   t
20        ,xmltable('/ROWSET/ROW'
21                  passing t.xml
22                  columns empno    number       path '/ROW/EMPNO'
23                         ,ename    varchar2(10) path '/ROW/ENAME'
24                         ,job      varchar2(9)  path '/ROW/JOB'
25                         ,mgr      number       path '/ROW/MGR'
26                         ,hiredate date         path '/ROW/HIREDATE'
27                         ,sal      number       path '/ROW/SAL'
28                         ,comm     number       path '/ROW/COMM'
29                         ,deptno   number       path '/ROW/DEPTNO'
30                 ) x
31  /
Enter value for cnt_chk: 1
old   1: with t as (select case when count(*) = &cnt_chk then
new   1: with t as (select case when count(*) = 1 then
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
      7369 SMITH      CLERK           7902 17-DEC-1980        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-1981       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-1981       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-1981       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-1981       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-1981       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-1981       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-1987       3000                    20
      7839 KING       PRESIDENT            17-NOV-1981       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-1981       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-1987       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-1981        950                    30
      7902 FORD       ANALYST         7566 03-DEC-1981       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-1982       1300                    10
14 rows selected.
SQL> /
Enter value for cnt_chk: 0
old   1: with t as (select case when count(*) = &cnt_chk then
new   1: with t as (select case when count(*) = 0 then
no rows selectedAs far as I can tell, the query to get the data (in my example from the emp table) is only executed by the XMLGen.GetXML if the condition matches, the only thing being that you're left with XML data which you then need to extract back out to flat data.

Similar Messages

  • Conditional SQL in Report Query

    How can I code a conditional SQL in the Report query builder
    to include a WHERE clause parameter or not, depending on the value
    of a report parameter? Basically, what I want to do is:
    select field from table where x=1
    <cfif param.a eq 1>and a=1</cfif>
    Report builder does not like this, but I can't find any help
    on how to do this.

    I don't think CFML tags may be used like that in the SQL of
    report query. But then, I'm not very much into reports. If you're
    just out to get the result, then try
    select field from table
    where
    (x=1 and #param.a# <> 1) or (x=1 and #param.a#=1 and
    a=1)

  • Conditional SQL ( Want to avoid having to write a PL/SQL block )

    I have a SQL statement and I was hoping to not have to write an IF-THEN-ELSE condition. Here is the SQL in hand which I need to expand.
    I need to list the personal information including address of all the employees. However, in the event that I encounter any address ( Home or Office ) where my State is *"NY"*, I should not list the "NY" Address but instead list the address where my address_location = 'O' and address_state_code = *"CA"*.
    Here is my code below. Now, the DB procedure call could retrieve the latest address id as a "NY" location and hence my question.
    SELECT '"'||emp.employee_name,
                  ||'","'||TO_CHAR(emp.birth_date,'YYYY/MM/DD')
                  ||'","'||emp.gender
                  ||'","'||RTRIM(ead.address_line1)
                  ||'","'||RTRIM(ead.address_line2)
                  ||'","'||RTRIM(ead.address_line3)
                  ||'","'||RTRIM(ead.address_location) -- 'O': Office; 'H': Home
                  ||'","'||RTRIM(ead.adh_city)
                  ||'","'||ead.address_zip_code
                  ||'","'||ead.address_state_code
    FROM    employee             emp,
                employee_address ead
    WHERE  emp.emp_num = ead.emp_num
    -- The proccedure db_get_address_id returns me the most recent Address with Max Effective Date
    AND      ead.address_id = db_get_address_id( emp.emp_num )
    ORDER BY v.effective_date DESC, emp.employee_name ASC;
    {code}
    Thanks in advance !                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    SELECT  emp_address
      FROM  (
             SELECT  '"'||emp.employee_name,
                            ||'","'||TO_CHAR(emp.birth_date,'YYYY/MM/DD')
                            ||'","'||emp.gender
                            ||'","'||RTRIM(ead.address_line1)
                            ||'","'||RTRIM(ead.address_line2)
                            ||'","'||RTRIM(ead.address_line3)
                            ||'","'||RTRIM(ead.address_location) -- 'O': Office; 'H': Home
                            ||'","'||RTRIM(ead.adh_city)
                            ||'","'||ead.address_zip_code
                            ||'","'||ead.address_state_code emp_address,
                            ROW_NUMBER() OVER(ORDER BY v.effective_date DESC, emp.employee_name ASC) RN,
                            CASE
                              WHEN ead.address_state_code = 'NY' THEN CASE MAX(
                                                                               CASE ead.address_state_code
                                                                                 WHEN 'CA' THEN 1
                                                                               END
                                                                              ) OVER(PARTITION BY emp.emp_num)
                                                                        WHEN 1 THEN 0
                                                                        ELSE 1
                                                                      END
                              ELSE 1
                            END TAKE_IT -- 0 means it is NY address for employee who also has CA address, 1 otherwise.
               FROM  employee emp,
                     employee_address ead
               WHERE emp.emp_num = ead.emp_num
                 -- The proccedure db_get_address_id returns me the most recent Address with Max Effective Date
                 AND ead.address_id = db_get_address_id(emp.emp_num)
      WHERE TAKE_IT = 1
      ORDER BY RN
    {code}
    SY.
    Edited by: Solomon Yakobson on Aug 13, 2009 1:38 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Bug report - Branch condition (SQL exists query)

    APEX 2.2.1
    See http://i13.tinypic.com/2ni8gol.jpg
    The branch condition is a "Exists SQL query" with select from dual where 1=2 i.e. it is a invalid SQL query, as the screenshot shows.
    But the APEX accept processing engine just ignores the syntax error and proceeds to evaluate the next branch.
    Thanks

    thanks, Vikas. It's interesting that if you don't have any later branches on the page that fire, you will see the condition error (along with the "no page to branch to" error).
    Scott

  • Table - Conditional SQL possible?

    Application Express 4.1.1.00.23
    Just wondering if the following is possible.
    I have created users and groups,
    for example;
    user1
    user2
    user3
    group1
    group2
    I have assigned the users to the groups as follows;
    Group 1 Members
    user1
    user2
    Group 2 Members
    user3
    In my table I have a column called Visibility values will be either "Internal Only" and "Public".
    Is there a way I can use a conditional query that will do the following;
    if apex_util.current_user_in_group('Group1') then
    Select * from Customer where Visibility = Public
    and
    if apex_util.current_user_in_group('Group2') then
    Select * from Customer where Visibility = Internal Only
    I've been googling the hell out of this, I would generally use PHP and create the page from scratch but I think Apex will be useful if I can learn how to use it!
    Thanks for your time :D

    Create a hidden page item - call it
    P1_VISIBILITYCreate a page Computation for that item of type PL/SQL Function and put there the following code:
    BEGIN
       IF apex_util.current_user_in_group ('Group1')
       THEN
          RETURN 'Public';
       ELSIF apex_util.current_user_in_group ('Group1')
       THEN
          RETURN 'Internal Only';
       END IF;
    END;Your query:
    SELECT *
      FROM customer
    WHERE visibility = :p1_visibilityshould now work as expected. There are many ways to do that in APEX. This is just one of them and easy to understand.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • Conditions: SQL Expression vs. PL/SQL expression

    In a Condition, what is the difference between a SQL Expression and a PL/SQL expression? The examples shown when creating, say a validation show similar things
    example of pl/sql expression: to_char(sysdate,'d')=1
    example of sql expression: instr(...) > 0
    Arent the 2 expressions above similar? What makes one a sql expression and other a plsql expression?
    Thanks

    Thanks, but I think its more than a matter of documentation.
    I had a SQL expression like
    :REQUEST IN ('button1','button2') AND NOT pkg.fn
    where pkg.fn is, of course, a packaged function returning BOOLEAN.
    The process that this condition was attached to was just not firing. No errors, nothing. I was ready to tear my hair out! I changed the expression type from SQL to PL/SQL and everything was fine.
    I think there should be a check in the App Builder for this kind of thing so that such invalid conditions are not allowed to be created.
    Thanks

  • Whether it is impossible to get a lob locator by a select condition sql?

    Hi,
    guys, i have tried many times, in oraclc, if i insert a row into a table with lob object, for example, the clob. i can get the lob locator back by a reset which come from stmt.execute (select_sql) clause.
    however, if i insert thus record with other tools, for example, the sql_plus, i will never get the locator back even if i have commit it, it always said that it is a DBMS_lob ERROR while i connect a write stream to it.
    wer ist das? could somebody give me some tips?
    thank you in advance.
    jedy borris
    null

    seems i got it: for update,right?
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by frederick zora ([email protected]):
    Hi,
    guys, i have tried many times, in oraclc, if i insert a row into a table with lob object, for example, the clob. i can get the lob locator back by a reset which come from stmt.execute (select_sql) clause.
    however, if i insert thus record with other tools, for example, the sql_plus, i will never get the locator back even if i have commit it, it always said that it is a DBMS_lob ERROR while i connect a write stream to it.
    wer ist das? could somebody give me some tips?
    thank you in advance.
    jedy borris
    <HR></BLOCKQUOTE>
    null

  • Search error, think its my sql

    Hello,
    I followed the How To: Extend the Easy Report doc and everything is fine until I reach the point of selecting the column under ADD/MODIFY CONDITIONS. I select the drop down list and my only choice is "No Column", which seems fine to me since I want to search the entire report and not just a specific column. So with No Column selected, I include like '%'||upper(:search)||'%' in the condition. The result is 1 error has occurred. The condition you are adding has caused the query to be invalid.
    Am I overlooking something in my SQL. I've scoured the forums and studied searchable reports created through wizards but have still not fund a solution. Any suggestions??
    Thank you.Leo.

    Sorry, I am using HTML DB V1.6.
    The "How To" document I was referring to is How To:Easy Extend EZ Report.
    The view I have does not allow me to see the query but does show a preview of the condition:
    SQL Representation of Condition:
    ((like '%'||upper(:search)||'%'))

  • Multiple values from database on a single text item

    i am trying to do the following
    on a single text item in a form
    (under form property pallete->records->number of items displayed is 5) run a triger "when-new-block-instance" with the following pl/sql statement
    declare
    menu_item VARCHAR2(35);
    begin
    select label into menu_item
    from menu_options;
    end;
    however, once i run the form it gives me
    WHEN-NEW-BLOCK-INSTANCE trigger raised unhandeled exception ORA-01422
    however, if in the pl/sql statement contains only
    begin
    execute querry;
    end;
    then it works fine
    The problem i beleive is the fact that the first querry retreives multiple values or recordset instead of A record.
    How can i go arond this and allow the form to list all the values in this form. Eventually i will need to add conditional SQL statments and that is why just execute querry will not work.
    Also, is there a way to dynamically assign a number to "number of records shown" property?
    All help is very much appreciated!
    null

    Hi, Marko
    I teach Forms, and I usually find a bad idea to use SQL statements directly (in particular when you can "make" Forms to do what you want).
    Inside PL/SQL, a SELECT..INTO statement is supposed to select a single row, otherwise an error occurs.
    EXECUTE_QUERY works.
    If by "conditional SQL statements" you mean restricted (filtered) queries, you don't need to write SQL to do this.
    You can set the DEFAULT_WHERE block property to a different value before using EXECUTE_QUERY, like:
    SET_BLOCK_PROPERTY('your_block', DEFAULT_WHERE, 'where menu_id > 100');
    And the answer to your second question is no, you cannot dynamically change the number of records a block is displaying.
    You can limit the number of records your block queries from the database table using Maximum Records Fetched block property (available in Forms 6 and above, not sure about Forms 5). However, this will only work as expected if you set Query All Records to Yes.
    Hope this helps,
    Pedro

  • APEX_INSTANCE_ADMIN PACKAGE NOT FOUND IN APEX 4.0

    Hi,
    I have created a workspace in APEX 4.0 and named it POC_TEST with a schema called POC_TEST .I am trying to run the below command in SQL Commands Window to automate the creation of any workspace in APEX.
    ALTER SESSION SET CURRENT_SCHEMA=APEX_040000;
    BEGIN
    APEX_INSTANCE_ADMIN.ADD_WORKSPACE(8675309,'MY_WORKSPACE','POC_TEST','POC_TEST1');
    END;
    The following error throws up in the SQL Parsing window:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'APEX_INSTANCE_ADMIN' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    1. BEGIN
    2. APEX_INSTANCE_ADMIN.ADD_WORKSPACE(8675309,'MY_WORKSPACE','POC_TEST','POC_TEST1');
    3. END;
    I tried running the below PL/SQL statement:
    SELECT object_name
    FROM all_objects
    WHERE object_type = 'PACKAGE'
    AND object_name = 'APEX_INSTANCE_ADMIN'
    But it said 'No Data Found'
    Please reply to this if anybody has a solution.

    I am not sure about why its not working on your environment, but here it is fine.
    I do note that your query:
    839060 wrote:
    SELECT object_name
    FROM all_objects
    WHERE object_type = 'PACKAGE'
    AND object_name = 'APEX_INSTANCE_ADMIN'
    But it said 'No Data Found'Is producing the correct output based on those conditions:
    SQL>  select object_name,object_type from all_objects where object_name like 'APEX_INSTANCE%';
    OBJECT_NAME                 OBJECT_TYPE
    APEX_INSTANCE_ADMIN            SYNONYM
    APEX_INSTANCE_ADMIN            SYNONYMTa,
    Trent
    Edited by: trent on Feb 23, 2011 11:07 PM
    Most likely you are connected to a user that does not have permissions to use apex_instance_admin.
    Edited by: trent on Feb 23, 2011 11:08 PM
    The APEX_INSTANCE_ADMIN package provides utilities for managing an Oracle Application Express runtime environment. You use the APEX_INSTANCE_ADMIN package to get and set email settings, wallet settings, report printing settings and to manage scheme to workspace mappings. APEX_INSTANCE_ADMIN can be executed by the SYS, SYSTEM, and APEX_040000 database users as well as any database user granted the role APEX_ADMINISTRATOR_ROLE.http://download.oracle.com/docs/cd/E17556_01/doc/apirefs.40/e15519/apex_instance.htm#CACGJEDD
    Even though you are altering the session, probably you need to first connect with a user with the appropriate roles.

  • Radio Button with Submit Ready Only problem

    Hello,
    My radio button with submit ready only condition doesn't work correctly. When I click the a link on the first page
    it brings me to an update page. I have a radio button with submit, that won't open as a read only.
    It is being populated by SQL query, with the Null option selected. When I open the page I don't want the user to be able to edit the field unless they delete records associated with the field. Pretty much I want it to be disabled if the user has a record associated with it.
    Here are the queries.
    Source:
    SELECT OPLAN_IMPACTED_I
    FROM DFCY
    WHERE DFCY_SEQNO = :P12_DFCY_SEQNO
    Read only condition:
    SQL Exists query
    SELECT o.dfcy_seqno
    FROM oplan_impactd o, dfcy d
    WHERE o.dfcy_seqno = :p12_dfcy_seqno
    and :P12_OPLAN_IMPACTED_I = d.OPLAN_IMPACTED_I
    and :P12_OPLAN_IMPACTED_I = 'Yes'
    So when the page renders it's like you can change oplan, how do I make it read only when the page renders?
    Thanks,
    Mary

    Hi,
    If that is the source of the radiogroup, then it should be:
    SELECT OPLAN_IMPACTED_I d, OPLAN_IMPACTED_I r
    FROM DFCY
    WHERE DFCY_SEQNO = :P12_DFCY_SEQNOThis should return two values for each radio button - the displayed text and the returned value. If your radios do not have a returned value, then "Yes" will never be found. You can check this by loading the page and doing a View Source on it - search for RADIO and check what "value" attributes they have.
    Andy

  • L2TP and fixed Framed IP Address for VPN user

    Hi,
    I have a running L2TP/IPsec VPN setup with authentification against a radius server (freeradius2 witch mysql). I would like to have some of my VPN users get a fixed IP address instead of the dynamically assigned IP Pool.
    The radius server is returning the correct parameters, I think.
    I hope someone can help me.
    It´s a Cisco 892 Integrated Service Router.
    Router Config:
    =============================================================
    Current configuration : 8239 bytes
    ! Last configuration change at 10:44:26 CEST Fri Mar 30 2012 by root
    version 15.2
    service timestamps debug datetime msec
    service timestamps log datetime msec
    service password-encryption
    service internal
    hostname vpngw2
    boot-start-marker
    boot config usbflash0:CVO-BOOT.CFG
    boot-end-marker
    logging buffered 51200 warnings
    enable secret 5 secret
    aaa new-model
    aaa authentication login default local group radius
    aaa authentication login userauthen local group radius
    aaa authentication ppp default group radius local
    aaa authorization exec default local
    aaa authorization network groupauthor local
    aaa accounting delay-start
    aaa accounting update newinfo
    aaa accounting exec default
    action-type start-stop
    group radius
    aaa accounting network default
    action-type start-stop
    group radius
    aaa accounting resource default
    action-type start-stop
    group radius
    aaa session-id common
    clock timezone CET 1 0
    clock summer-time CEST recurring last Sun Mar 2:00 last Sun Oct 3:00
    ip domain name aspect-online.de
    ip name-server 10.28.1.31
    ip inspect WAAS flush-timeout 10
    ip inspect name DEFAULT100 ftp
    ip inspect name DEFAULT100 h323
    ip inspect name DEFAULT100 icmp
    ip inspect name DEFAULT100 netshow
    ip inspect name DEFAULT100 rcmd
    ip inspect name DEFAULT100 realaudio
    ip inspect name DEFAULT100 rtsp
    ip inspect name DEFAULT100 esmtp
    ip inspect name DEFAULT100 sqlnet
    ip inspect name DEFAULT100 streamworks
    ip inspect name DEFAULT100 tftp
    ip inspect name DEFAULT100 tcp
    ip inspect name DEFAULT100 udp
    ip inspect name DEFAULT100 vdolive
    ip cef
    no ipv6 cef
    virtual-profile if-needed
    multilink bundle-name authenticated
    async-bootp dns-server 10.28.1.31
    async-bootp nbns-server 10.28.1.31
    vpdn enable
    vpdn authen-before-forward
    vpdn authorize directed-request
    vpdn-group L2TP
    ! Default L2TP VPDN group
    accept-dialin
      protocol l2tp
      virtual-template 1
    no l2tp tunnel authentication
    license udi pid -K9 sn FCZ
    username root password 7 secret
    ip ssh source-interface FastEthernet8
    ip ssh version 2
    crypto isakmp policy 10
    encr 3des
    authentication pre-share
    group 2
    lifetime 3600
    crypto isakmp key mykey address 0.0.0.0         no-xauth
    crypto ipsec transform-set configl2tp esp-3des esp-sha-hmac
    mode transport
    crypto dynamic-map config-map-l2tp 10
    set nat demux
    set transform-set configl2tp
    crypto map vpnl2tp 10 ipsec-isakmp dynamic config-map-l2tp
    interface BRI0
    no ip address
    encapsulation hdlc
    shutdown
    isdn termination multidrop
    interface FastEthernet0
    no ip address
    spanning-tree portfast
    interface FastEthernet1
    no ip address
    spanning-tree portfast
    <snip>
    interface FastEthernet7
    no ip address
    spanning-tree portfast
    interface FastEthernet8
    ip address 10.28.1.97 255.255.255.0
    ip access-group vpn_to_lan out
    ip nat inside
    ip virtual-reassembly in
    duplex auto
    speed auto
    interface Virtual-Template1
    ip unnumbered GigabitEthernet0
    ip access-group vpn_to_inet_lan in
    ip nat inside
    ip virtual-reassembly in
    peer default ip address pool l2tpvpnpool
    ppp encrypt mppe 128
    ppp authentication chap
    interface GigabitEthernet0
    description WAN Port
    ip address x.x.x.39 255.255.255.0
    ip access-group from_inet in
    ip nat outside
    ip virtual-reassembly in
    duplex auto
    speed auto
    crypto map vpnl2tp
    interface Vlan1
    no ip address
    shutdown
    ip local pool l2tpvpnpool 192.168.252.3 192.168.252.199
    ip local pool remotepool 192.168.252.240 192.168.252.243
    ip forward-protocol nd
    no ip http server
    no ip http secure-server
    ip nat log translations syslog
    ip nat inside source route-map natmap interface GigabitEthernet0 overload
    ip route 0.0.0.0 0.0.0.0 x.x.x.33
    ip access-list extended from_inet
    <snip>
    ip access-list extended nat_clients
    permit ip 192.168.252.0 0.0.0.255 any
    ip access-list extended vpn_to_inet_lan
    <snip>
    ip access-list extended vpn_to_lan
    <snip>
    deny   ip any any log-input
    logging trap debugging
    logging facility local2
    logging 10.28.1.42
    no cdp run
    route-map natmap permit 10
    match ip address nat_clients
    radius-server attribute 8 include-in-access-req
    radius-server host 10.27.1.228 auth-port 1812 acct-port 1813
    radius-server key 7 mykey
    radius-server vsa send accounting
    radius-server vsa send authentication
    control-plane
    mgcp profile default
    banner login ^C
    Hostname: vpngw2
    Model: Cisco 892 Integrated Service Router
    Description: L2TP/IPsec VPN Gateway with Radius Auth
    ^C
    line con 0
    line aux 0
    line vty 0 4
    access-class 23 in
    privilege level 15
    transport input telnet ssh
    line vty 5 15
    access-class 23 in
    privilege level 15
    transport input telnet ssh
    =============================================================
    User Config in Radius (tying multiple attributes):
    =============================================================
    Attribute          | op | Value
    Service-Type       | =  | Framed-User
    Cisco-AVPair       | =  | vpdn:ip-addresses=192.168.252.220
    Framed-IP-Address  | := | 192.168.252.221
    Cisco-AVPair       | =  | ip:addr-pool=remotepool
    =============================================================
    Debug Log from freeradius2:
    =============================================================
    rad_recv: Access-Request packet from host 10.28.1.97 port 1645, id=7, length=100
            Framed-Protocol = PPP
            User-Name = "me1"
            CHAP-Password = 0x01b8b897de00317a75c68ee9ce473cf8b8
            Connect-Info = "100000000"
            NAS-Port-Type = Sync
            NAS-Port = 10007
            NAS-Port-Id = "Uniq-Sess-ID7"
            Service-Type = Framed-User
            NAS-IP-Address = 10.28.1.97
    # Executing section authorize from file /etc/raddb/sites-enabled/default
    +- entering group authorize {...}
    ++[preprocess] returns ok
    [chap] Setting 'Auth-Type := CHAP'
    ++[chap] returns ok
    ++[mschap] returns noop
    ++[digest] returns noop
    [suffix] No '@' in User-Name = "me1", looking up realm NULL
    [suffix] No such realm "NULL"
    ++[suffix] returns noop
    [eap] No EAP-Message, not doing EAP
    ++[eap] returns noop
    [files] users: Matched entry DEFAULT at line 172
    ++[files] returns ok
    [sql]   expand: %{User-Name} -> me1
    [sql] sql_set_user escaped user --> 'me1'
    rlm_sql (sql): Reserving sql socket id: 4
    [sql]   expand: SELECT id, username, attribute, value, op           FROM radcheck           WHERE username = '%{SQL-User-Name}'           ORDER BY id -> SELECT id, username, attribute, value, op           FROM radcheck           WHERE username = 'me1'           ORDER BY id
    [sql] User found in radcheck table
    [sql]   expand: SELECT id, username, attribute, value, op           FROM radreply           WHERE username = '%{SQL-User-Name}'           ORDER BY id -> SELECT id, username, attribute, value, op           FROM radreply           WHERE username = 'me1'           ORDER BY id
    [sql]   expand: SELECT groupname           FROM radusergroup           WHERE username = '%{SQL-User-Name}'           ORDER BY priority -> SELECT groupname           FROM radusergroup           WHERE username = 'me1'           ORDER BY priority
    rlm_sql (sql): Released sql socket id: 4
    ++[sql] returns ok
    ++[expiration] returns noop
    ++[logintime] returns noop
    [pap] WARNING: Auth-Type already set.  Not setting to PAP
    ++[pap] returns noop
    Found Auth-Type = CHAP
    # Executing group from file /etc/raddb/sites-enabled/default
    +- entering group CHAP {...}
    [chap] login attempt by "me1" with CHAP password
    [chap] Using clear text password "test" for user me1 authentication.
    [chap] chap user me1 authenticated succesfully
    ++[chap] returns ok
    Login OK: [me1/<CHAP-Password>] (from client vpngw2 port 10007)
    # Executing section post-auth from file /etc/raddb/sites-enabled/default
    +- entering group post-auth {...}
    ++[exec] returns noop
    Sending Access-Accept of id 7 to 10.28.1.97 port 1645
            Framed-Protocol = PPP
            Framed-Compression = Van-Jacobson-TCP-IP
            Framed-IP-Address := 192.168.252.221
            Cisco-AVPair = "vpdn:ip-addresses=192.168.252.220"
            Service-Type = Framed-User
    Finished request 0.
    Going to the next request
    Waking up in 4.9 seconds.
    rad_recv: Accounting-Request packet from host 10.28.1.97 port 1646, id=19, length=213
            Acct-Session-Id = "00000011"
            Tunnel-Type:0 = L2TP
            Tunnel-Medium-Type:0 = IPv4
            Tunnel-Server-Endpoint:0 = "x.x.x.39"
            Tunnel-Client-Endpoint:0 = "x.x.x.34"
            Tunnel-Assignment-Id:0 = "L2TP"
            Tunnel-Client-Auth-Id:0 = "me1"
            Tunnel-Server-Auth-Id:0 = "vpngw2"
            Framed-Protocol = PPP
            Framed-IP-Address = 192.168.252.9
            User-Name = "me1"
            Cisco-AVPair = "connect-progress=LAN Ses Up"
            Acct-Authentic = RADIUS
            Acct-Status-Type = Start
            Connect-Info = "100000000"
            NAS-Port-Type = Sync
            NAS-Port = 10007
            NAS-Port-Id = "Uniq-Sess-ID7"
            Service-Type = Framed-User
            NAS-IP-Address = 10.28.1.97
            Acct-Delay-Time = 0
    # Executing section preacct from file /etc/raddb/sites-enabled/default
    +- entering group preacct {...}
    ++[preprocess] returns ok
    [acct_unique] Hashing 'NAS-Port = 10007,Client-IP-Address = 10.28.1.97,NAS-IP-Address = 10.28.1.97,Acct-Session-Id = "00000011",User-Name = "me1"'
    [acct_unique] Acct-Unique-Session-ID = "1fdd95abea6cfac2".
    ++[acct_unique] returns ok
    [suffix] No '@' in User-Name = "me1", looking up realm NULL
    [suffix] No such realm "NULL"
    ++[suffix] returns noop
    ++[files] returns noop
    # Executing section accounting from file /etc/raddb/sites-enabled/default
    +- entering group accounting {...}
    [detail]        expand: %{Packet-Src-IP-Address} -> 10.28.1.97
    [detail]        expand: /var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d -> /var/log/radius/radacct/10.28.1.97/detail-20120330
    [detail] /var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d expands to /var/log/radius/radacct/10.28.1.97/detail-20120330
    [detail]        expand: %t -> Fri Mar 30 11:20:07 2012
    ++[detail] returns ok
    ++[unix] returns ok
    [radutmp]       expand: /var/log/radius/radutmp -> /var/log/radius/radutmp
    [radutmp]       expand: %{User-Name} -> me1
    ++[radutmp] returns ok
    [sql]   expand: %{User-Name} -> me1
    [sql] sql_set_user escaped user --> 'me1'
    [sql]   expand: %{Acct-Delay-Time} -> 0
    [sql]   expand:            INSERT INTO radacct             (acctsessionid,    acctuniqueid,     username,              realm,            nasipaddress,     nasportid,              nasporttype,      acctstarttime,    acctstoptime,              acctsessiontime,  acctauthentic,    connectinfo_start,              connectinfo_stop, acctinputoctets,  acctoutputoctets,              calledstationid,  callingstationid, acctterminatecause,              servicetype,      framedprotocol,   framedipaddress,              acctstartdelay,   acctstopdelay,    xascendsessionsvrkey)           VALUES             ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}',              '%{SQL-User-Name}',              '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}',              '%{NAS-Port-Type}', '%S', NULL,              '0', '%{Acct-Authentic}', '%{Connect-Info}',              '', '0', '0',              '%{Called-Station-Id}', '%{Calling-Station-Id}', '',              '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}',
    rlm_sql (sql): Reserving sql socket id: 3
    rlm_sql (sql): Released sql socket id: 3
    ++[sql] returns ok
    ++[exec] returns noop
    [attr_filter.accounting_response]       expand: %{User-Name} -> me1
    attr_filter: Matched entry DEFAULT at line 12
    ++[attr_filter.accounting_response] returns updated
    Sending Accounting-Response of id 19 to 10.28.1.97 port 1646
    Finished request 1.
    Cleaning up request 1 ID 19 with timestamp +53
    Going to the next request
    Waking up in 4.9 seconds.
    rad_recv: Accounting-Request packet from host 10.28.1.97 port 1646, id=20, length=407
            Acct-Session-Id = "00000011"
            Tunnel-Type:0 = L2TP
            Tunnel-Medium-Type:0 = IPv4
            Tunnel-Server-Endpoint:0 = "x.x.x.39"
            Tunnel-Client-Endpoint:0 = "x.x.x.34"
            Tunnel-Assignment-Id:0 = "L2TP"
            Tunnel-Client-Auth-Id:0 = "me1"
            Tunnel-Server-Auth-Id:0 = "vpngw2"
            Framed-Protocol = PPP
            Framed-IP-Address = 192.168.252.9
            Cisco-AVPair = "ppp-disconnect-cause=Received LCP TERMREQ from peer"
            User-Name = "me1"
            Acct-Authentic = RADIUS
            Cisco-AVPair = "connect-progress=LAN Ses Up"
            Cisco-AVPair = "nas-tx-speed=100000000"
            Cisco-AVPair = "nas-rx-speed=100000000"
            Acct-Session-Time = 5
            Acct-Input-Octets = 5980
            Acct-Output-Octets = 120
            Acct-Input-Packets = 47
            Acct-Output-Packets = 11
            Acct-Terminate-Cause = User-Request
            Cisco-AVPair = "disc-cause-ext=PPP Receive Term"
            Acct-Status-Type = Stop
            Connect-Info = "100000000"
            NAS-Port-Type = Sync
            NAS-Port = 10007
            NAS-Port-Id = "Uniq-Sess-ID7"
            Service-Type = Framed-User
            NAS-IP-Address = 10.28.1.97
            Acct-Delay-Time = 0
    # Executing section preacct from file /etc/raddb/sites-enabled/default
    +- entering group preacct {...}
    ++[preprocess] returns ok
    [acct_unique] Hashing 'NAS-Port = 10007,Client-IP-Address = 10.28.1.97,NAS-IP-Address = 10.28.1.97,Acct-Session-Id = "00000011",User-Name = "me1"'
    [acct_unique] Acct-Unique-Session-ID = "1fdd95abea6cfac2".
    ++[acct_unique] returns ok
    [suffix] No '@' in User-Name = "me1", looking up realm NULL
    [suffix] No such realm "NULL"
    ++[suffix] returns noop
    ++[files] returns noop
    # Executing section accounting from file /etc/raddb/sites-enabled/default
    +- entering group accounting {...}
    [detail]        expand: %{Packet-Src-IP-Address} -> 10.28.1.97
    [detail]        expand: /var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d -> /var/log/radius/radacct/10.28.1.97/detail-20120330
    [detail] /var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d expands to /var/log/radius/radacct/10.28.1.97/detail-20120330
    [detail]        expand: %t -> Fri Mar 30 11:20:12 2012
    ++[detail] returns ok
    ++[unix] returns ok
    [radutmp]       expand: /var/log/radius/radutmp -> /var/log/radius/radutmp
    [radutmp]       expand: %{User-Name} -> me1
    ++[radutmp] returns ok
    [sql]   expand: %{User-Name} -> me1
    [sql] sql_set_user escaped user --> 'me1'
    [sql]   expand: %{Acct-Input-Gigawords} ->
    [sql]   ... expanding second conditional
    [sql]   expand: %{Acct-Input-Octets} -> 5980
    [sql]   expand: %{Acct-Output-Gigawords} ->
    [sql]   ... expanding second conditional
    [sql]   expand: %{Acct-Output-Octets} -> 120
    [sql]   expand: %{Acct-Delay-Time} -> 0
    [sql]   expand:            UPDATE radacct SET              acctstoptime       = '%S',              acctsessiontime    = '%{Acct-Session-Time}',              acctinputoctets    = '%{%{Acct-Input-Gigawords}:-0}' << 32 |                                   '%{%{Acct-Input-Octets}:-0}',              acctoutputoctets   = '%{%{Acct-Output-Gigawords}:-0}' << 32 |                                   '%{%{Acct-Output-Octets}:-0}',              acctterminatecause = '%{Acct-Terminate-Cause}',              acctstopdelay      = '%{%{Acct-Delay-Time}:-0}',              connectinfo_stop   = '%{Connect-Info}'           WHERE acctsessionid   = '%{Acct-Session-Id}'           AND username          = '%{SQL-User-Name}'           AND nasipaddress      = '%{NAS-IP-Address}' ->            UPDATE radacct SET              acctstoptime       = '2012-03-30 11:20:12',              acctsessiontime    = '5',              acctinputoctets    = '0' << 32 |                                   '5980',              acctoutputoctets   = '0' << 32 |
    rlm_sql (sql): Reserving sql socket id: 2
    rlm_sql (sql): Released sql socket id: 2
    ++[sql] returns ok
    ++[exec] returns noop
    [attr_filter.accounting_response]       expand: %{User-Name} -> me1
    attr_filter: Matched entry DEFAULT at line 12
    ++[attr_filter.accounting_response] returns updated
    Sending Accounting-Response of id 20 to 10.28.1.97 port 1646
    Finished request 2.
    Cleaning up request 2 ID 20 with timestamp +58
    Going to the next request
    Waking up in 0.1 seconds.
    Cleaning up request 0 ID 7 with timestamp +53
    Ready to process requests.
    =============================================================
    Log From Cisco Router:
    =============================================================
    Mar 30 11:20:07 vpngw2 1217: Mar 30 09:21:51.414: RADIUS/ENCODE(00000015):Orig. component type = VPDN
    Mar 30 11:20:07 vpngw2 1218: Mar 30 09:21:51.414: RADIUS: DSL line rate attributes successfully added
    Mar 30 11:20:07 vpngw2 1219: Mar 30 09:21:51.414: RADIUS(00000015): Config NAS IP: 0.0.0.0
    Mar 30 11:20:07 vpngw2 1220: Mar 30 09:21:51.414: RADIUS(00000015): Config NAS IPv6: ::
    Mar 30 11:20:07 vpngw2 1221: Mar 30 09:21:51.414: RADIUS/ENCODE: No idb found! Framed IP Addr might not be included
    Mar 30 11:20:07 vpngw2 1222: Mar 30 09:21:51.414: RADIUS/ENCODE(00000015): acct_session_id: 17
    Mar 30 11:20:07 vpngw2 1223: Mar 30 09:21:51.414: RADIUS(00000015): sending
    Mar 30 11:20:07 vpngw2 1224: Mar 30 09:21:51.418: RADIUS/ENCODE: Best Local IP-Address 10.28.1.97 for Radius-Server 10.27.1.228
    Mar 30 11:20:07 vpngw2 1225: Mar 30 09:21:51.418: RADIUS(00000015): Send Access-Request to 10.27.1.228:1812 id 1645/7, len 100
    Mar 30 11:20:07 vpngw2 1226: Mar 30 09:21:51.418: RADIUS:  authenticator DE 5F 2E 3E EF BF 50 F4 - 49 C3 4F BE 1A 66 72 22
    Mar 30 11:20:07 vpngw2 1227: Mar 30 09:21:51.418: RADIUS:  Framed-Protocol     [7]   6   PPP                       [1]
    Mar 30 11:20:07 vpngw2 1228: Mar 30 09:21:51.418: RADIUS:  User-Name           [1]   5   "me1"
    Mar 30 11:20:07 vpngw2 1229: Mar 30 09:21:51.418: RADIUS:  CHAP-Password       [3]   19  *
    Mar 30 11:20:07 vpngw2 1230: Mar 30 09:21:51.418: RADIUS:  Connect-Info        [77]  11  "100000000"
    Mar 30 11:20:07 vpngw2 1231: Mar 30 09:21:51.418: RADIUS:  NAS-Port-Type       [61]  6   Sync                      [1]
    Mar 30 11:20:07 vpngw2 1232: Mar 30 09:21:51.418: RADIUS:  NAS-Port            [5]   6   10007
    Mar 30 11:20:07 vpngw2 1233: Mar 30 09:21:51.418: RADIUS:  NAS-Port-Id         [87]  15  "Uniq-Sess-ID7"
    Mar 30 11:20:07 vpngw2 1234: Mar 30 09:21:51.418: RADIUS:  Service-Type        [6]   6   Framed                    [2]
    Mar 30 11:20:07 vpngw2 1235: Mar 30 09:21:51.418: RADIUS:  NAS-IP-Address      [4]   6   10.28.1.97
    Mar 30 11:20:07 vpngw2 1236: Mar 30 09:21:51.418: RADIUS(00000015): Sending a IPv4 Radius Packet
    Mar 30 11:20:07 vpngw2 1237: Mar 30 09:21:51.418: RADIUS(00000015): Started 5 sec timeout
    Mar 30 11:20:07 vpngw2 1238: Mar 30 09:21:51.422: RADIUS: Received from id 1645/7 10.27.1.228:1812, Access-Accept, len 85
    Mar 30 11:20:07 vpngw2 1239: Mar 30 09:21:51.422: RADIUS:  authenticator 25 CD 93 D5 78 2C F4 4F - F2 66 2C 45 8D D4 E1 16
    Mar 30 11:20:07 vpngw2 1240: Mar 30 09:21:51.422: RADIUS:  Framed-Protocol     [7]   6   PPP                       [1]
    Mar 30 11:20:07 vpngw2 1241: Mar 30 09:21:51.422: RADIUS:  Framed-Compression  [13]  6   VJ TCP/IP Header Compressi[1]
    Mar 30 11:20:07 vpngw2 1242: Mar 30 09:21:51.422: RADIUS:  Framed-IP-Address   [8]   6   192.168.252.221
    Mar 30 11:20:07 vpngw2 1243: Mar 30 09:21:51.422: RADIUS:  Vendor, Cisco       [26]  41
    Mar 30 11:20:07 vpngw2 1244: Mar 30 09:21:51.422: RADIUS:   Cisco AVpair       [1]   35  "vpdn:ip-addresses=192.168.252.220"
    Mar 30 11:20:07 vpngw2 1245: Mar 30 09:21:51.422: RADIUS:  Service-Type        [6]   6   Framed                    [2]
    Mar 30 11:20:07 vpngw2 1246: Mar 30 09:21:51.426: RADIUS(00000015): Received from id 1645/7
    Mar 30 11:20:07 vpngw2 1247: Mar 30 09:21:51.438: %LINK-3-UPDOWN: Interface Virtual-Access3, changed state to up
    Mar 30 11:20:07 vpngw2 1248: Mar 30 09:21:51.442: %LINEPROTO-5-UPDOWN: Line protocol on Interface Virtual-Access3, changed state to up
    Mar 30 11:20:07 vpngw2 1249: Mar 30 09:21:51.478: RADIUS/ENCODE(00000015):Orig. component type = VPDN
    Mar 30 11:20:07 vpngw2 1250: Mar 30 09:21:51.478: RADIUS(00000015): Config NAS IP: 0.0.0.0
    Mar 30 11:20:07 vpngw2 1251: Mar 30 09:21:51.478: RADIUS(00000015): Config NAS IPv6: ::
    Mar 30 11:20:07 vpngw2 1252: Mar 30 09:21:51.478: RADIUS(00000015): sending
    Mar 30 11:20:07 vpngw2 1253: Mar 30 09:21:51.478: RADIUS/ENCODE: Best Local IP-Address 10.28.1.97 for Radius-Server 10.27.1.228
    Mar 30 11:20:07 vpngw2 1254: Mar 30 09:21:51.478: RADIUS(00000015): Send Accounting-Request to 10.27.1.228:1813 id 1646/19, len 213
    Mar 30 11:20:07 vpngw2 1255: Mar 30 09:21:51.478: RADIUS:  authenticator 1B E0 A3 DF 16 7F F1 8D - E5 7F BD 88 50 01 73 53
    Mar 30 11:20:07 vpngw2 1256: Mar 30 09:21:51.478: RADIUS:  Acct-Session-Id     [44]  10  "00000011"
    Mar 30 11:20:07 vpngw2 1257: Mar 30 09:21:51.478: RADIUS:  Tunnel-Type         [64]  6   00:
    Mar 30 11:20:07 vpngw2 1258: L2TP                   [3]
    Mar 30 11:20:07 vpngw2 1259: Mar 30 09:21:51.478: RADIUS:  Tunnel-Medium-Type  [65]  6   00:IPv4                   [1]
    Mar 30 11:20:07 vpngw2 1260: Mar 30 09:21:51.478: RADIUS:  Tunnel-Server-Endpoi[67]  16  "x.x.x.39"
    Mar 30 11:20:07 vpngw2 1261: Mar 30 09:21:51.478: RADIUS:  Tunnel-Client-Endpoi[66]  16  "x.x.x.34"
    Mar 30 11:20:07 vpngw2 1262: Mar 30 09:21:51.478: RADIUS:  Tunnel-Assignment-Id[82]  6   "L2TP"
    Mar 30 11:20:07 vpngw2 1263: Mar 30 09:21:51.478: RADIUS:  Tunnel-Client-Auth-I[90]  5   "me1"
    Mar 30 11:20:07 vpngw2 1264: Mar 30 09:21:51.478: RADIUS:  Tunnel-Server-Auth-I[91]  8   "vpngw2"
    Mar 30 11:20:07 vpngw2 1265: Mar 30 09:21:51.478: RADIUS:  Framed-Protocol     [7]   6   PPP                       [1]
    Mar 30 11:20:07 vpngw2 1266: Mar 30 09:21:51.478: RADIUS:  Framed-IP-Address   [8]   6   192.168.252.9
    Mar 30 11:20:07 vpngw2 1267: Mar 30 09:21:51.478: RADIUS:  User-Name           [1]   5   "me1"
    Mar 30 11:20:07 vpngw2 1268: Mar 30 09:21:51.478: RADIUS:  Vendor, Cisco       [26]  35
    Mar 30 11:20:07 vpngw2 1269: Mar 30 09:21:51.478: RADIUS:   Cisco AVpair       [1]   29  "connect-progress=LAN Ses Up"
    Mar 30 11:20:07 vpngw2 1270: Mar 30 09:21:51.478: RADIUS:  Acct-Authentic      [45]  6   RADIUS                    [1]
    Mar 30 11:20:07 vpngw2 1271: Mar 30 09:21:51.482: RADIUS:  Acct-Status-Type    [40]  6   Start                     [1]
    Mar 30 11:20:07 vpngw2 1272: Mar 30 09:21:51.482: RADIUS:  Connect-Info        [77]  11  "100000000"
    Mar 30 11:20:07 vpngw2 1273: Mar 30 09:21:51.482: RADIUS:  NAS-Port-Type       [61]  6   Sync                      [1]
    Mar 30 11:20:07 vpngw2 1274: Mar 30 09:21:51.482: RADIUS:  NAS-Port            [5]   6   10007
    Mar 30 11:20:08 vpngw2 1275: Mar 30 09:21:51.482: RADIUS:  NAS-Port-Id         [87]  15  "Uniq-Sess-ID7"
    Mar 30 11:20:08 vpngw2 1276: Mar 30 09:21:51.482: RADIUS:  Service-Type        [6]   6   Framed                    [2]
    Mar 30 11:20:08 vpngw2 1277: Mar 30 09:21:51.482: RADIUS:  NAS-IP-Address      [4]   6   10.28.1.97
    Mar 30 11:20:08 vpngw2 1278: Mar 30 09:21:51.482: RADIUS:  Acct-Delay-Time     [41]  6   0
    Mar 30 11:20:08 vpngw2 1279: Mar 30 09:21:51.482: RADIUS(00000015): Sending a IPv4 Radius Packet
    Mar 30 11:20:08 vpngw2 1280: Mar 30 09:21:51.482: RADIUS(00000015): Started 5 sec timeout
    Mar 30 11:20:08 vpngw2 1281: Mar 30 09:21:51.486: RADIUS: Received from id 1646/19 10.27.1.228:1813, Accounting-response, len 20
    Mar 30 11:20:08 vpngw2 1282: Mar 30 09:21:51.486: RADIUS:  authenticator 73 5E 95 46 5B 57 B1 4A - 44 4F 7C 71 F0 26 AA A4
    Mar 30 11:20:12 vpngw2 1283: Mar 30 09:21:56.282: RADIUS/ENCODE(00000015):Orig. component type = VPDN
    Mar 30 11:20:12 vpngw2 1284: Mar 30 09:21:56.282: RADIUS(00000015): Config NAS IP: 0.0.0.0
    Mar 30 11:20:12 vpngw2 1285: Mar 30 09:21:56.282: RADIUS(00000015): Config NAS IPv6: ::
    Mar 30 11:20:12 vpngw2 1286: Mar 30 09:21:56.282: RADIUS(00000015): sending
    Mar 30 11:20:12 vpngw2 1287: Mar 30 09:21:56.282: RADIUS/ENCODE: Best Local IP-Address 10.28.1.97 for Radius-Server 10.27.1.228
    Mar 30 11:20:12 vpngw2 1288: Mar 30 09:21:56.286: RADIUS(00000015): Send Accounting-Request to 10.27.1.228:1813 id 1646/20, len 407
    Mar 30 11:20:12 vpngw2 1289: Mar 30 09:21:56.286: RADIUS:  authenticator 26 7A 27 91 EB 3F 34 C6 - DB 2D 88 F8 B1 A4 C1 12
    Mar 30 11:20:12 vpngw2 1290: Mar 30 09:21:56.286: RADIUS:  Acct-Session-Id     [44]  10  "00000011"
    Mar 30 11:20:12 vpngw2 1291: Mar 30 09:21:56.286: RADIUS:  Tunnel-Type         [64]  6   00:
    Mar 30 11:20:12 vpngw2 1292: L2TP                   [3]
    Mar 30 11:20:12 vpngw2 1293: Mar 30 09:21:56.286: RADIUS:  Tunnel-Medium-Type  [65]  6   00:IPv4                   [1]
    Mar 30 11:20:12 vpngw2 1294: Mar 30 09:21:56.286: RADIUS:  Tunnel-Server-Endpoi[67]  16  "x.x.x.39"
    Mar 30 11:20:12 vpngw2 1295: Mar 30 09:21:56.286: RADIUS:  Tunnel-Client-Endpoi[66]  16  "x.x.x.34"
    Mar 30 11:20:12 vpngw2 1296: Mar 30 09:21:56.286: RADIUS:  Tunnel-Assignment-Id[82]  6   "L2TP"
    Mar 30 11:20:12 vpngw2 1297: Mar 30 09:21:56.286: RADIUS:  Tunnel-Client-Auth-I[90]  5   "me1"
    Mar 30 11:20:12 vpngw2 1298: Mar 30 09:21:56.286: RADIUS:  Tunnel-Server-Auth-I[91]  8   "vpngw2"
    Mar 30 11:20:12 vpngw2 1299: Mar 30 09:21:56.286: RADIUS:  Framed-Protocol     [7]   6   PPP                       [1]
    Mar 30 11:20:12 vpngw2 1300: Mar 30 09:21:56.286: RADIUS:  Framed-IP-Address   [8]   6   192.168.252.9
    Mar 30 11:20:12 vpngw2 1301: Mar 30 09:21:56.286: RADIUS:  Vendor, Cisco       [26]  59
    Mar 30 11:20:12 vpngw2 1302: Mar 30 09:21:56.286: RADIUS:   Cisco AVpair       [1]   53  "ppp-disconnect-cause=Received LCP TERMREQ from peer"
    Mar 30 11:20:12 vpngw2 1303: Mar 30 09:21:56.286: RADIUS:  User-Name           [1]   5   "me1"
    Mar 30 11:20:12 vpngw2 1304: Mar 30 09:21:56.286: RADIUS:  Acct-Authentic      [45]  6   RADIUS                    [1]
    Mar 30 11:20:12 vpngw2 1305: Mar 30 09:21:56.286: RADIUS:  Vendor, Cisco       [26]  35
    Mar 30 11:20:12 vpngw2 1306: Mar 30 09:21:56.286: RADIUS:   Cisco AVpair       [1]   29  "connect-progress=LAN Ses Up"
    Mar 30 11:20:12 vpngw2 1307: Mar 30 09:21:56.286: RADIUS:  Vendor, Cisco       [26]  30
    Mar 30 11:20:12 vpngw2 1308: Mar 30 09:21:56.286: RADIUS:   Cisco AVpair       [1]   24  "nas-tx-speed=100000000"
    Mar 30 11:20:12 vpngw2 1309: Mar 30 09:21:56.286: RADIUS:  Vendor, Cisco       [26]  30
    Mar 30 11:20:12 vpngw2 1310: Mar 30 09:21:56.286: RADIUS:   Cisco AVpair       [1]   24  "nas-rx-speed=100000000"
    Mar 30 11:20:12 vpngw2 1311: Mar 30 09:21:56.286: RADIUS:  Acct-Session-Time   [46]  6   5
    Mar 30 11:20:12 vpngw2 1312: Mar 30 09:21:56.286: RADIUS:  Acct-Input-Octets   [42]  6   5980
    Mar 30 11:20:12 vpngw2 1313: Mar 30 09:21:56.286: RADIUS:  Acct-Output-Octets  [43]  6   120
    Mar 30 11:20:12 vpngw2 1314: Mar 30 09:21:56.286: RADIUS:  Acct-Input-Packets  [47]  6   47
    Mar 30 11:20:12 vpngw2 1315: Mar 30 09:21:56.286: RADIUS:  Acct-Output-Packets [48]  6   11
    Mar 30 11:20:12 vpngw2 1316: Mar 30 09:21:56.286: RADIUS:  Acct-Terminate-Cause[49]  6   user-request              [1]
    Mar 30 11:20:12 vpngw2 1317: Mar 30 09:21:56.286: RADIUS:  Vendor, Cisco       [26]  39
    Mar 30 11:20:12 vpngw2 1318: Mar 30 09:21:56.286: RADIUS:   Cisco AVpair       [1]   33  "disc-cause-ext=PPP Receive Term"
    Mar 30 11:20:12 vpngw2 1319: Mar 30 09:21:56.286: RADIUS:  Acct-Status-Type    [40]  6   Stop                      [2]
    Mar 30 11:20:12 vpngw2 1320: Mar 30 09:21:56.286: RADIUS:  Connect-Info        [77]  11  "100000000"
    Mar 30 11:20:12 vpngw2 1321: Mar 30 09:21:56.286: RADIUS:  NAS-Port-Type       [61]  6   Sync                      [1]
    Mar 30 11:20:12 vpngw2 1322: Mar 30 09:21:56.286: RADIUS:  NAS-Port            [5]   6   10007
    Mar 30 11:20:12 vpngw2 1323: Mar 30 09:21:56.286: RADIUS:  NAS-Port-Id         [87]  15  "Uniq-Sess-ID7"
    Mar 30 11:20:12 vpngw2 1324: Mar 30 09:21:56.286: RADIUS:  Service-Type        [6]   6   Framed                    [2]
    Mar 30 11:20:12 vpngw2 1325: Mar 30 09:21:56.286: RADIUS:  NAS-IP-Address      [4]   6   10.28.1.97
    Mar 30 11:20:12 vpngw2 1326: Mar 30 09:21:56.286: RADIUS:  Acct-Delay-Time     [41]  6   0
    Mar 30 11:20:12 vpngw2 1327: Mar 30 09:21:56.286: RADIUS(00000015): Sending a IPv4 Radius Packet
    Mar 30 11:20:12 vpngw2 1328: Mar 30 09:21:56.286: RADIUS(00000015): Started 5 sec timeout
    Mar 30 11:20:12 vpngw2 1329: Mar 30 09:21:56.294: RADIUS: Received from id 1646/20 10.27.1.228:1813, Accounting-response, len 20
    Mar 30 11:20:12 vpngw2 1330: Mar 30 09:21:56.294: RADIUS:  authenticator E1 09 A6 6D 91 C6 B1 B3 - 78 00 FF 4F 25 32 C6 B5
    Mar 30 11:20:12 vpngw2 1331: Mar 30 09:21:56.406: %LINK-3-UPDOWN: Interface Virtual-Access3, changed state to down
    Mar 30 11:20:12 vpngw2 1332: Mar 30 09:21:56.410: %LINEPROTO-5-UPDOWN: Line protocol on Interface Virtual-Access3, changed state to down
    =============================================================

    I found the failure.
    In the cisco config it must be
    aaa authorization network default group radius local
    not
    aaa authorization network groupauthor local

  • Restrict access to buttons, regions, etc. on a per user basis?

    My application restricts access to buttons, regions, etc. on a per user basis.
    Here is my application logic...
    1. A User can only edit items they own.
    2. A Super-User can edit all items
    So, when a user logs in, I use a post-authentication process to set the user ID to an application level item.
    Now, for example, to have an edit button display on a page, I need to check the item's owner ID against the application level user ID...and check to see if this user is on the Super User list via a query.(which could be set to another application level item upon login...I guess)
    Question...What is the best way to do this? Conditional display? Authorization scheme?
    Would something like the following work for a Conditional Display?
    Condition: SQL Expression
    &USER_ID.=&P6_ITEM_OWNER_ID. OR USER_ID in (select USER_ID from table where USER_ID=&USER_ID.)
    How would I do this with an Authorization Scheme? (I like the idea of updating the logic in single location...but I'm not sure if it is possible because I have to check PX_OWNER_ID would be different on each page.)

    Hi Denes,
    Thanks for your code which allows user to edit (if authorized) and view (if not).
    But some how - I do not get the image to show up - instead it show a small underline.
    From SQL point of view - here is what I get - when i run the sql
    '<img src="/i/ed-item.gif">',2,CR TEST,,,,dune2.cit.cornell.edu,CRDMTEST.CIT.CORNELL.EDU,PSPROD,,,CRDMTEST
    Here is my wrap_image function
    create or replace function wrap_image(p_user_name in varchar2,p_dm_name_id in number)
    return varchar2 IS
    v boolean := False;
    ret_val varchar2(1000);
    begin
    dbms_output.put_line('user='||p_user_name);
    dbms_output.put_line('dm_name='||p_dm_name_id);
    -- Check authorization if the user is super user - return true, else if he has edit priv on dm_name_id - return true - else false
    v:=ACL_DMTOOLS_DM_PRIV(p_user_name,p_dm_name_id);
    if v then
    ret_val := '<img src="/i/ed-item.gif">';
    ret_val := ''''||ret_val||'''';
    dbms_output.put_line('TRUE');
    else
    ret_val := '';
    dbms_output.put_line('FALSE');
    end if;
    return ret_val;
    end;
    Thanks for your great educational site.
    Regards
    atul

  • Externally created pagination buttons

    Hi there,
    How do I create "externally created pagination buttons" ?
    In a multi-page tabular report, I would like to submit each page before I go to next page (to save updates). Am I right in guessing that I could use custom buttons to submit the page before moving on to the next page ?
    Thanks,
    Shailendra.

    hey shailendra--
    those "Externally Created Pagination Buttons" are a bit of a throw back to the older way of doing pagination from the htmldb beta days, but they still works fine. to set them up, you create two buttons with exact names, "FLOW_PREVIOUS_PAGE" and "FLOW_NEXT_PAGE". you'd probably also want to put the conditions, "SQL Reports (okay to show back button)" and "SQL Reports (okay to show forward button)", respectively on them. after that, pagination works as you'd expect. the catch to this, though, is that those button won't work to submit your form data as you're hoping. to allow your users to submit tabular form data as they page through tabular form data, you'd have to add an additional page submission mechanism (button, for instance) to your page.
    hope this helps,
    raj

  • DB columns with spaces

    Hi Forte Users,
    This is the second time I submit the question since I just got
    properly subcribed in.
    We have an existing Paradox database with spaces in the column names
    (eg. CONTR
    FIRST NAME rather than CONTR_FIRST_NAME). When we try to select using
    Forte's SQL
    Select syntax we get the following error for the below SQL:
    sql select
    "CONTR BANET PHONE" as Phone,
    "CONTR SSN" as SSN,
    "CONTR COMMENTS" as Comments,
    "CONTR ORIGINAL ADD DT" as OriginalAddDt
    from CONTR
    where "CONTR SSN" > ''
    USER ERROR: OpenCursor failed for SQL statement in project
    CTSConversionLibrarian, class ContractorConvLibrarian, method
    _GetAll,
    methodId 3, line 9, error from database is:
    ODBC SQLExecute (open cursor) failed.
    [Microsoft][ODBC Paradox Driver] '` CONTR BANET PHONE `' isn't a
    valid
    parameter name.
    Class: qqdb_UsageException with ReasonCode: DB_ER_SYNTAXERROR
    Detected at: qqdb_OdbcCursor::VendorOpen at 20
    Last TOOL statement: method ContractorConvLibrarian._GetAll, line
    1
    Error Time: Mon Mar 17 11:59:32
    ODBC SQLSTATE: 37000, ODBC error: -1002, Server: CTSOLD, UserName:
    admin
    Database Statement: select " CONTR BANET PHONE " as Phone , "
    CONTR SSN "
    as SSN , " CONTR COMMENTS " as Comments , " CONTR ORIGINAL ADD
    DT " as
    OriginalAddDt from CONTR where " CONTR SSN " >''
    Exception occurred (remotely) on partition
    "CTSConversionControllers_CL0_Part1", (partitionId =
    EDD21522-95BA-11D0-BE45-40D33FACAA77:0x26a:0x2, taskId =
    [EDD21522-95BA-11D0-BE45-40D33FACAA77:0x266:0x5.384]) in
    application
    "Forte Runtime", pid 150 on node W13175ADICKSON in environment
    ftsdev.
    Although when we send the select via the dynamic SQL objects it works.
    We have
    tried delimiting the column names with ", "', ', etc but nothing has
    worked. If
    anybody has found a solution we appreaciate hearing about it.
    Thanks

    This will return not just AB2 followd by spaces but also AB2 followed with anything (or nothing). That's why you still need second condition:
    SQL> WITH t AS (SELECT 'AB1' AS id, 1 AS prod_id FROM dual UNION ALL
      2  SELECT 'AB2222  ', 2 FROM dual UNION ALL
      3  SELECT 'AB212345   ', 2 FROM dual UNION ALL
      4  SELECT 'AB2 ', 3 FROM dual)
      5  SELECT * FROM t
      6  WHERE id LIKE 'AB2%'
      7  /
    ID             PROD_ID
    AB2222               2
    AB212345             2
    AB2                  3
    SQL> WITH t AS (SELECT 'AB1' AS id, 1 AS prod_id FROM dual UNION ALL
      2  SELECT 'AB2222  ', 2 FROM dual UNION ALL
      3  SELECT 'AB212345   ', 2 FROM dual UNION ALL
      4  SELECT 'AB2 ', 3 FROM dual)
      5  SELECT * FROM t
      6  WHERE id LIKE 'AB2%'
      7    AND RTRIM(id) = 'AB2'
      8  /
    ID             PROD_ID
    AB2                  3
    SQL> SY.

Maybe you are looking for