Creating Functions in View

Hai..
i had a problem regarding the creation of function..
the problem is:
i need to compare the column values to get the minimum rate..
i.e
my problem goes like this..
i have a view with four fields of number datatype
how to get minimum valu of each row
eg..
weigh1 weigh2 weigh3
25 50 70
50 70 70
the result should be:
weigh1 weigh2 weigh3 result
25 50 70 25
50 70 70 50
here the result col contains min value of each row..
thanks
nandakumarc

Select w1,w2,w3,Least(w1,w2,w3) from ...

Similar Messages

  • Create sequence, function and view all at once -script or something similar

    Hi I would like to know in what way can I write a script or something like that which would define names for a sequence, function and a view in the beginning (for example TEST_SEQ, TEST_FJ, TEST_VIEW...) and after that create this sequence, function and view with definitions like
    CREATE SEQUENCE  TEST_SEQ
    MINVALUE 1 MAXVALUE 999999999999999999999999999
    INCREMENT BY 1 START WITH 1 NOCACHE  NOORDER  NOCYCLE;
    create or replace FUNCTION TEST_FJ RETURN NUMBER AS
    tmp number;
    BEGIN
    select TEST_SEQ.NEXTVAL  into tmp from dual
    RETURN tmp;
    END TEST_FJ;
    and so on...
    In the end I would also like to grant some rights on these objects I just created:
    grant select on TEST_SEQ to public;
    grant execute on TEST_FJ to public;
    So my question is how to package all these things together so I can execute them from a single file in SQL Developer, and if i need to change the names of these tables I want do it in one place in the beginning of this script (or something like a script, I'm not sure what)...
    Thanks in advance!

    hi,
    hope help you...
    this is my basic generic solution...
    create or replace procedure createSequence( psequenceName in varchar2 ) is
    begin
    execute immediate 'create sequence ' || psequenceName ;
    execute immediate 'grant select on ' || psequenceName || ' to public ';
    end ;
    create or replace function getNextVal( psequenceName in varchar2 ) return number is
    queryText varchar2(100) := 'select <sequence_name>.nextval into :next_value from DUAL' ;
    next_value number ;
    begin
    queryText := replace(queryText,'<sequence_name>',psequenceName);
    execute immediate queryText into next_value ;
    return( next_value ) ;
    end ;
    Edited by: edogt on Nov 27, 2008 5:33 AM
    Edited by: edogt on Nov 27, 2008 5:35 AM
    Edited by: edogt on Nov 27, 2008 5:35 AM

  • How to create function group in Maintainence view

    Hi,
    For creating a maintainence view of a particular table (only1) what is the need of a function group. How can i create a function group like what type of includes, etc are present in the function group,etc.
    Thanks,
    Arnab

    in the table maintenance view
    just enter the function group name any(Z* )
    and give the screen name (single or over view Scree)
    It will automatically creates the function group which ever you specified.
    now the function group contains
    the screen, TOp include ...
    Thanks
    Sekhar.

  • Create functions in cluster views.

    Hi Experts,
    As per our customer requirment, time configuration tables should be accessed by more than 1 person at the same time. In order to do so, were thinking about create a cluster view (se56).
    throug events avaliable for this cluster we can trigger some code tu unlock the table and perform checks.
    Do you know which functions are avaliable to perform the following checkings?
    In example, i access to -. V_T551A ( period workschedules)
    i can find out by the name of the period workscheduel which EE subgroup is asigned to this period workschedule.
    1)when i enter to the selected view, i would like to check my profile and check my EE subgroup.
    2)check the selected entry i´m currently trying to modify, and access its fields to perform (description) to perform these heckings (my EE subgroup == EE ubgroup correct to modify this entry).
    3)if  ok, them i´m allowed to make the modification and save.
    Any idea about how to access this information from the program?
    With KR
    Ruben.

    Hi,
    Check this...
    http://erpgenie.com/index.php?option=com_content&task=view&id=462&Itemid=77

  • A problem when I try to create a application view throug a Bea MQSeries Adapter8.1

              Hi, guys!
              I have installed Weblogic platform 8.1 beta, and try to use the MQSeries Adapter
              which provide by Bea weblogic, and it's seems I must deploy the .ear file which
              is an application include the MQ Adapter, on a domain which provide the Integration
              function, the ear file I was download from bea site. So I deploy it in the samples/domain/platform
              domain as the docs told me. And after that I create a new directory called session
              and a subdirectory contain a manifest.xml file, I do this also due to the docs
              provide by Bea. And then I can create the application view in the application
              view console, BUT, when I try to add a Event in the console, the page and OS console
              both print this message :
              DEBUG 21 ?? 2003 20:43:11,906 BEA_MQSERIES_1_0.DesignTime - getMergedDictionary
              got exception:
              DEBUG 21 ?? 2003 20:43:11,906 BEA_MQSERIES_1_0.DesignTime -
              StackTrace:
              java.lang.NullPointerException
              at com.ibi.beamqseries.web.DesignTimeRequestHandler.getMergedDictionary(DesignTimeRequestHandler.java:372)
              at jsp_servlet.__addservc._jspService(__addservc.java:120)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
              at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1047)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:383)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:301)
              at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:547)
              at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:364)
              at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:153)
              at jsp_servlet.__display._jspService(__display.java:632)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
              at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1047)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:383)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:301)
              at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6319)
              at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
              at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3525)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2553)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
              And I'm not quit sure about how to make the Schema directory correcttly, I just
              make one manifest.xml file. and hope I can find more document about the adapter,
              or can fix this problem.
              by the way, I just have userguid, installguide and releasenotes pdf file which
              can be download from Bea
              Regards,
              shannon
              

    Can you tell me the exact url of the BEA_MQSERIES_8_1.ear?
              Please give it to me... Thanks in advance...

  • How to create a buy view??

    Hello,
        i  need to create a buy view in a material. I found a function called BAPI_MATERIAL_MAINTAINDATA_RT but it don´t create the buy view.
    Any idea?
    Thanks!

    Hello,
    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
    EXPORTING
    headdata = T_HEAD
    PLANTDATA = T_MARC
    PLANTDATAX = T_MARCX
    STORAGELOCATIONDATA = T_MARD
    STORAGELOCATIONDATAX = T_MARDX
    SALESDATA = T_MVKE
    SALESDATAX = T_MVKEX
    IMPORTING
    RETURN = T_RETURN
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
    WAIT = 'X'
    IMPORTING
    RETURN = T_RETURN

  • Create a classification view over bapi

    Hello,
    i start a vb Programm to create a material in sap.
    I get all views with material_savedata but the classification view is missing.
    Does anybody know if there exist a special bapi to create a classification view
    over the .net connector ?
    thanks for any help

    Hello , thanks a lot for the answers. I am using a vb programm with the proxy connector.
    In this connector i have defined:
            Dim oClassnum As String
            Dim oClasstype As String
            Dim oKeydatum As String
            Dim oLanguage As String
            Dim oObjectkey As String
            Dim oObjecttable As String
            Dim oUnvaluated_char As String
            Dim oStandardklasse As String
            Dim oStatus As String
            Dim oAllocvaluechar As New BAPI1003_ALLOC_VALUES_CHARTable
            Dim oAllocvaluecurr As New BAPI1003_ALLOC_VALUES_CURRTable
            Dim oAllocvaluesnum As New BAPI1003_ALLOC_VALUES_NUMTable
            Dim oReturn0 As New BAPIRET2Table
    Try
                oProxy.Bapi_Objcl_Getdetail(oClassnum, oClasstype, oKeydatum, _
                oLanguage, _
                oObjectkey, oObjecttable, oUnvaluated_char, oStandardklasse, _
                oStatus, oAllocvaluechar, _
                oAllocvaluecurr, oAllocvaluesnum, oReturn0)
                MsgBox(oReturn0.Item(0).Message.ToString)
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
    When i start the programm i get the error:
    The function  OBJECT_CHECK_ does not exist. 
    WHY ??
    I have also tried to use 
    Bapi_Charact_Getdetail
    to test, if something works but i really do'nt know what the meaning of
    the parameters are . Perhaps somebody can explain them to me.
    I have tried with charactername and used a  *  but the result is always 0.
    Has somebody a documentation of the fields and tables that are
    needed or filled or a little example of the us of the classification.
    thanks a lot

  • Create a materialized view :-

    How do I create a materialized view on a view ,so that it will refresh automatically on every commit in base table where the view having more that 9 function ?

    Read Materialized View Refresh for complete information.
    For a Jist:
    Refresh Mode Description
    ON COMMIT
    Refresh occurs automatically when a transaction that modified one of the materialized view's detail tables commits. This can be specified as long as the materialized view is fast refreshable (in other words, not complex). The ON COMMIT privilege is necessary to use this mode.
    ON DEMAND
    Refresh occurs when a user manually executes one of the available refresh procedures contained in the DBMS_MVIEW package (REFRESH, REFRESH_ALL_MVIEWS, REFRESH_DEPENDENT).
    When a materialized view is maintained using the ON COMMIT method, the time required to complete the commit may be slightly longer than usual. This is because the refresh operation is performed as part of the commit process. Therefore this method may not be suitable if many users are concurrently changing the tables upon which the materialized view is based.
    If you anticipate performing insert, update or delete operations on tables referenced by a materialized view concurrently with the refresh of that materialized view, and that materialized view includes joins and aggregation, Oracle recommends you use ON COMMIT fast refresh rather than ON DEMAND fast refresh.
    If you think the materialized view did not refresh, check the alert log or trace file.
    If a materialized view fails during refresh at COMMIT time, you must explicitly invoke the refresh procedure using the DBMS_MVIEW package after addressing the errors specified in the trace files. Until this is done, the materialized view will no longer be refreshed automatically at commit time.

  • Creating a new view to search local database

    SA
    i need to create a new view that searches my local db for certain clumns
    and i need the filter to have drop down lists based on my instace variables objects
    any suggesstions please ?

    You cannot implement that functionality using the Workspace views. I suggest having a screenflow that uses a JSP to display the information in the way you want. This screenflow can be exposed as a global activity.

  • Creating a Materialized View from different agregate queries

    I want to create a materialized view. The problem is that doing so can get sticky. The view should have one row, with each column representing the return of an aggregate function on the base table. Here is a query that returns this kind of result:
    select
         (select count(rowid) from pasta) "PASTA_ROWS",
         (select count(salt) from pasta where salt='F') "SALT_IS_FEMALE_ROWS"
    from dual;
    You can see that by selecting the subqueries from dual, I get the return to be in seperate columns. The problem is that when I try creating a Materialized view, I get an error.
    ERROR at line 8:
    ORA-22818: subquery expressions not allowed here
    So, is there a simple SQL query that will return the values I am asking for, in seperate columns, but will not make the materialized view produce an error?
    Thanks,
    Edward
    For your reference, here is a describe of the pasta table:
    SQL> desc pasta
    Name Null? Type
    CHEESE NUMBER(4)
    TOMATO VARCHAR2(20)
    SALT VARCHAR2(1)
    OREGANO VARCHAR2(20)
    OLIVE_OIL VARCHAR2(40)

    Edward:
    Something like this should work:
    SELECT COUNT(*) PASTA_ROWS,
           SUM(DECODE(salt,'F',1,0)) SALT_IS_FEMALE_ROWS
    FROM pastaTTFN
    John

  • Creating a combined view of two spatially indexed tables

    Hi All,
    I'm using oracle 10g and C++ occi to store and retrieve data. I have two tables that are identical in structure, they have an SDO_GEOM column where I store lat/long/altitude info. When I store the data using a stored procedure, the data is put into the correct table. I now want to retrieve the data using a spatial operator - I use SDO_NN to retrive data within a given distance of a lat/long/altitude point. This works fine for a single or multiple tables as I use a stored function to give me the data back as an object. I now have a requirement to list all the data from both tables - I thought I could do this by creating a combined view but I understand this cannot be done with spatial data - I habe also tried using the join operator but I am having problems since the columns for each table are identical. Is there any workaround for this - the combined view will not have any spatial operators run on it, I just need to return each row (the spatial data can be returned as individual lat/long/alt instead of as a SDO_GEOM. A second idea I had would be to return all the data using a ref cursor - this works for a single table but I do not understand how I can open the cursor with a select from two tables with identical column names.
    Unfortunately it is a requirement that the tables are seperate so combining the two tables into one is not an option.
    Thanks in advance for any help anyone can offer,
    Cheers,
    Rob

    You can create a UNION ALL view:
    CREATE TABLE cola_markets_1 (
    mkt_id NUMBER PRIMARY KEY,
    name VARCHAR2(32),
    shape SDO_GEOMETRY);
    CREATE TABLE cola_markets_2 (
    mkt_id NUMBER PRIMARY KEY,
    name VARCHAR2(32),
    shape SDO_GEOMETRY);
    CREATE VIEW v1 AS
    SELECT * FROM cola_markets_1 UNION ALL SELECT * FROM cola_markets_2;
    If both tables have a spatial index on their shape column, a query plan will look
    like:
    explain plan for SELECT c.mkt_id, c.name FROM v1 c WHERE SDO_NN(c.shape, SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), SDO_ORDINATE_ARRAY(4,6, 8,8)) , 'sdo_num_res=1') = 'TRUE';
    0 SELECT STATEMENT     |           |
    1 VIEW               | V1          |
    2 UNION-ALL          |           |
    3 TABLE ACCESS BY INDEX ROWID| COLA_MARKETS_1
    4 DOMAIN INDEX     | COLA_SPATIAL_IDX_1
    5 TABLE ACCESS BY INDEX ROWID| COLA_MARKETS_2
    6 DOMAIN INDEX     | COLA_SPATIAL_IDX_2
    However, the above SDO_NN query will return 2 rows (one from each table),
    because it can only work on one table, it won't return the nearest neighbor
    from the combined view without some tweaks. For example, to return the
    top one, you may try:
    select * from (SELECT c.mkt_id, c.name FROM v1 c WHERE SDO_NN(c.shape, SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), SDO_ORDINATE_ARRAY(4,6, 8,8)) , 'sdo_num_res=1') = 'TRUE' order by sdo_geom.sdo_distance(c.shape, SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), SDO_ORDINATE_ARRAY(4,6, 8,8)), 0.0001)) where rownum < 2;
    Note that you can only pass literals or bind variables into the second input parameter
    of spatial operators (including SDO_NN), when a UNION ALL view is used. i.e. the following
    query won't work right now:
    SELECT c.* FROM v1 c, another_table b WHERE b.id =1 and SDO_NN(c.shape, b.shape, 'sdo_num_res=1')= 'TRUE';

  • Usage SQL functions in View

    Hi,
    I need to create a SQL View in Java Dictionary component. Is it possible to use SQL functions like "UPPER", "LCASE" and so on in SELECT statement? For example I need to divide one column in table with type of TIMESTAMP on two columns in View with types DATA and TIME. But when I try to create a View in Java Dictionary like:
    CREATE VIEW "Z_TMP_DOMAIN_VIEW"
        ("Z_TMP_DOMAIN_ID","NAME")
    AS SELECT
        "a"."ID", left("a"."NAME",30)  "name"
    FROM
        "Z_TMP_DOMAIN" "a"
    The build failed with the error:
    Z_TMP_DOMAIN_VIEW': View  is not generated
         [ddgen] [Error]   DtDbView 'Z_TMP_DOMAIN_VIEW': View statement is incorrect: CREATE VIEW "Z_TMP_DOMAIN_VIEW"
         [ddgen]     ("Z_TMP_DOMAIN_ID","NAME")
         [ddgen] AS SELECT
         [ddgen]     "a"."ID", left("a"."NAME",30)  "name"
         [ddgen] FROM
         [ddgen]     "Z_TMP_DOMAIN" "a"
    Perhaps someone knows how can I work out  or work around this problem?

    Hi,
    I need to create a SQL View in Java Dictionary component. Is it possible to use SQL functions like "UPPER", "LCASE" and so on in SELECT statement? For example I need to divide one column in table with type of TIMESTAMP on two columns in View with types DATA and TIME. But when I try to create a View in Java Dictionary like:
    CREATE VIEW "Z_TMP_DOMAIN_VIEW"
        ("Z_TMP_DOMAIN_ID","NAME")
    AS SELECT
        "a"."ID", left("a"."NAME",30)  "name"
    FROM
        "Z_TMP_DOMAIN" "a"
    The build failed with the error:
    Z_TMP_DOMAIN_VIEW': View  is not generated
         [ddgen] [Error]   DtDbView 'Z_TMP_DOMAIN_VIEW': View statement is incorrect: CREATE VIEW "Z_TMP_DOMAIN_VIEW"
         [ddgen]     ("Z_TMP_DOMAIN_ID","NAME")
         [ddgen] AS SELECT
         [ddgen]     "a"."ID", left("a"."NAME",30)  "name"
         [ddgen] FROM
         [ddgen]     "Z_TMP_DOMAIN" "a"
    Perhaps someone knows how can I work out  or work around this problem?

  • Oracle Execution Time for function inside view

    Hi Guys,
    i would like to ask if i call a function inside a view , how does it behave in term of execution time and performance
    For Example i have a view as below
    create or replace view CUST.CUST_VIEW
    select a.nice , a.getCustomDisplay(a.name,a.pin,a.dos,b.master_key) as custom from CUST.customer as a , CUST.master as b
    where a.idno = b.main_id_no
    AND the function look like this
    create or replace function getCustomDisplay(a varchar2,b varchar2,c varchar2,d varchar2)
    begin
    select * from CUST.MAPPING_MATRIX order by idno asc;
    for loop
    //logic goes here to determine the result return from matrix
    end
    My Question is for example
    1. If i do select * from CUST.CUST_VIEW ( return 1000 records for example ) , so the function getCustomDisplay will be executed 1000 times also right ( that means select * from CUST.MAPPING_MATRIX order by idno asc; will also be executed 1000 times ) ?
    2. If i do select * from CUST.CUST_VIEW where rownum <= 20 , how many times getCustomDisplay() function will be executed ?
    The reason i ask this because recently we saw a few million execution times per day from AWR report for this query
    "select * from CUST.MAPPING_MATRIX order by idno asc;"
    But when i investigate , and put a logger whenever it call getCustomDisplay , the query above as mention in item no 2 only will be executed as many as the record that will be returned from ( view + where condition ).
    3. will it affect performance if my view return a lot of records ? or is there any way to improve it?
    Thanks

    Hi
    i have other solutions that seems work for reducing number of execution times but do you think its scalable and feasible ?
    CREATE OR REPLACE package body ACER.TYPE_CAT_PASS_UTIL_TEST as
    */* Private package data */*
    TYPE g_rec IS RECORD (
    id_no               VARCHAR2 (4),
    type_pass            VARCHAR2 (3),
    scheme_ind           VARCHAR2 (5),
    cat_pass             VARCHAR2 (2),
    entrepass            VARCHAR2 (2),
    display_type_pass        VARCHAR2 (15),
    display_cat_pass         VARCHAR2 (5),
    display_type_pass_desc    VARCHAR2 (80),
    rule_id                  VARCHAR2 (5)
    TYPE g_tab_type IS TABLE OF g_rec INDEX BY BINARY_INTEGER;
    g_tab   g_tab_type;
    i       BINARY_INTEGER;
    procedure initializeTypePassMatrix(test  IN varchar2) as
    begin
    if(g_tab.COUNT < 1)then
    FOR appln_rec in (
    SELECT tb_type_cat_pass_matrix.id_no,
    tb_type_cat_pass_matrix.type_pass,
    tb_type_cat_pass_matrix.scheme_ind,
    tb_type_cat_pass_matrix.cat_pass,
    tb_type_cat_pass_matrix.entrepass,
    tb_type_cat_pass_matrix.display_type_pass,
    tb_type_cat_pass_matrix.display_cat_pass,
    tb_type_cat_pass_matrix.display_type_pass_desc,
    tb_type_cat_pass_matrix.rule_id
    FROM tb_type_cat_pass_matrix ORDER BY id_no asc)
    LOOP
    dbms_output.put_line('g_tab.COUNT before insert: ' || g_tab.COUNT);
    i := g_tab.COUNT + 1;
    g_tab (i).id_no         := appln_rec.id_no;
    g_tab (i).type_pass         := appln_rec.type_pass;
    g_tab (i).scheme_ind        := appln_rec.scheme_ind;
    g_tab (i).cat_pass          := appln_rec.cat_pass;
    g_tab (i).entrepass        := appln_rec.entrepass;
    g_tab (i).display_type_pass     := appln_rec.display_type_pass;
    g_tab (i).display_cat_pass     := appln_rec.display_cat_pass;
    g_tab (i).display_type_pass_desc:= appln_rec.display_type_pass_desc;
    g_tab (i).rule_id         := appln_rec.rule_id;
    DBMS_OUTPUT.put_line ('g_tab.count after insert: ' || g_tab.COUNT);
    END LOOP;
    else
    DBMS_OUTPUT.put_line ('g_tab>=1, no need to initialize');
    end if;
    exception
    when others then
    dbms_output.put_line('error happen'||DBMS_UTILITY.format_error_backtrace);
    Logger.ERROR('TYPE_CAT_PASS_UTIL.initializeTypePassMatrix',SQLCODE,SQLERRM || ' ' ||DBMS_UTILITY.format_error_backtrace,'SYSTEM');
    end initializeTypePassMatrix;
    procedure populateTypeCatPassFullDesc(typePass  IN varchar2, schemeInd IN varchar2,catPass IN varchar2,entrePass IN varchar2, displayTypePass IN OUT varchar2,displayTypePassDesc IN OUT varchar2, displayCatPass IN OUT varchar2 )is
    v_displayTypePass varchar2(15) :='-';
    v_displayTypePassDesc varchar2(100) :='-';
    v_displayCatPass   varchar2 (2):='-';
    v_type_pass  varchar2(3)  := '';
    v_scheme_ind  varchar2(5) := '';
    v_cat_pass  varchar2(2);
    v_entrepass  varchar2(2);
    v_flag_valid_1 boolean:=false;
    v_flag_valid_2 boolean:=false;
    v_flag_valid_3 boolean:=false;
    v_flag_valid_4 boolean:=false;
    v_appln_rec g_rec;
    begin
    dbms_output.put_line('line 1');
    initializeTypePassMatrix('test');
    FOR nomor in g_tab.FIRST .. g_tab.LAST
    LOOP
    v_appln_rec := g_tab(nomor);
    dbms_output.put_line('line 2.1');
    v_flag_valid_1 :=false;
    v_flag_valid_2 :=false;
    v_flag_valid_3 :=false;
    v_flag_valid_4 :=false;
    v_type_pass     := v_appln_rec.type_pass;
    v_scheme_ind    := v_appln_rec.scheme_ind;
    v_cat_pass     := v_appln_rec.cat_pass;
    v_entrepass    := v_appln_rec.entrepass;
    dbms_output.put_line('line 2.2');
    if(typePass =  v_type_pass or v_type_pass = 'NA') then
    v_flag_valid_1:= true;
    end if;
    if(schemeInd = v_scheme_ind or v_scheme_ind='NA') then
    v_flag_valid_2 := true;
    elsif(schemeInd is null and v_scheme_ind is null) then
    v_flag_valid_2 := true;
    end if;
    if(catPass = v_cat_pass or v_cat_pass='NA') then
    v_flag_valid_3 := true;
    elsif(catPass is null and v_cat_pass is null) then
    v_flag_valid_3 := true;
    end if;
    if(entrePass = v_entrepass or v_entrepass='NA') then
    v_flag_valid_4 := true;
    end if;
    if(v_flag_valid_1 = true and v_flag_valid_2 = true and v_flag_valid_3 = true and v_flag_valid_4 = true) then
    v_displayTypePass     := v_appln_rec.display_type_pass;
    v_displayCatPass     := v_appln_rec.display_cat_pass;
    v_displayTypePassDesc   := v_appln_rec.display_type_pass_desc;
    dbms_output.put_line('rule id got :'||v_appln_rec.rule_id);
    dbms_output.put_line('rule no got :'||v_appln_rec.id_no);
    exit when (0 = 0);
    end if;
    END LOOP;
    displayTypePass := v_displayTypePass;
    displayCatPass  := v_displayCatPass;
    dbms_output.put_line('1type:' || v_displayTypePassDesc);
    displayTypePassDesc :=    v_displayTypePassDesc;
    dbms_output.put_line('2type:' || displayTypePassDesc);
    dbms_output.put_line('type:' || v_displayTypePass);
    dbms_output.put_line('cat :' || v_displayCatPass);
    exception
    when others then
    dbms_output.put_line('error happen'||DBMS_UTILITY.format_error_backtrace);
    Logger.ERROR('TYPE_CAT_PASS_UTIL.populateTypeCatPass',SQLCODE,SQLERRM || ' ' ||DBMS_UTILITY.format_error_backtrace,'SYSTEM');
    end populateTypeCatPassFullDesc;
    function getDisplayTypePass(typePass  IN varchar2, schemeInd IN varchar2,catPass IN varchar2,entrePass IN varchar2) return varchar2 is
    v_displayTypePass varchar2(15) :='-';
    v_displayTypePassDesc varchar2(100) :='-';
    v_displayCatPass varchar2(2) :='-';
    begin
    populateTypeCatPassFullDesc(typePass,schemeInd,catPass,entrePass,v_displayTypePass,v_displayTypePassDesc,v_displayCatPass);
    return  v_displayTypePass;
    exception
    when others then
    dbms_output.put_line('error happen'||DBMS_UTILITY.format_error_backtrace);
    Logger.ERROR('TYPE_CAT_PASS_UTIL.populateTypeCatPass',SQLCODE,SQLERRM || ' ' ||DBMS_UTILITY.format_error_backtrace,'SYSTEM');
    end getDisplayTypePass;
    end TYPE_CAT_PASS_UTIL_TEST;
    By Using like above even i do query on select * from <some_view) it will be only one execution for
    SELECT tb_type_cat_pass_matrix.id_no,*
    **tb_type_cat_pass_matrix.type_pass,**
    **tb_type_cat_pass_matrix.scheme_ind,**
    **tb_type_cat_pass_matrix.cat_pass,**
    **tb_type_cat_pass_matrix.entrepass,**
    **tb_type_cat_pass_matrix.display_type_pass,**
    **tb_type_cat_pass_matrix.display_cat_pass,**
    **tb_type_cat_pass_matrix.display_type_pass_desc,**
    **tb_type_cat_pass_matrix.rule_id**
    **FROM tb_type_cat_pass_matrix ORDER BY id_no asc*
    the key point is the initializeTypePassMatrix function but it seems the variable only works for one session ?
    if i open new session it will be reset again .

  • Using Max Function in View Criteria

    Hi
    I am having a requirement where by i need to make use of max function in view criteria but not able to see any such option. Can someone please help me over it. Here is the requirement.
    In table i will be having multiple rows for an employee and i need to pick latest row based on a column say request_id For e.g.
    Emp RequestId
    A 1
    A 2
    A 3
    A 4
    So if i pass the employee id i should get Row Number 4. In simple SQL language I want something like this
    select * from emp where empid=A and requestid=( select max(requestid) from emp where empid=A)
    Just wanted to know is there any approach that i can use to do all this as part of View Criteria or any other way.
    Any help is appreciated!!!
    Thanks
    AJ

    One way is this -
    1)https://blogs.oracle.com/adf/entry/using_groovy_aggregate_functions_in (You might need to create a self-referencing VL for this , try if it works using a ViewAccessor too)
    OR
    Order by RequestId descending in your SQL for the VO if thats ok , then have the ViewCriteria for the EmpId and programmatically pickup the first row...

  • How to create function module step by step

    hi experts,
    i am new to ABAP.
    can anybody tell me the step by step process on how to create a function module for adding two numbers without using editor screen.
    ex: 2+3=5.

    Hi,
    You can only create function modules and function groups using the Function Builder in the ABAP Workbench. For further information, refer to Creating New Function Modules. This section uses an example to illustrate how a function module is created from the point of view of ABAP programming.
    Function Groups and Function Modules:
    Firstly, we create a new function group DEMO_SPFLI to hold the function module. Then, we can create the new function module.
    Parameter Interface:
    You can specify the types of interface parameters in function modules in the
    same way as the parameter interfaces of subroutines. Since function
    modules can be used anywhere in the system, their interfaces can only contain
    references to data types that are declared systemwide. These are the elementary
    ABAP data types, the systemwide generic types, such as ANY TABLE, and types
    defined in the ABAP Dictionary. You cannot use LIKE to refer to data types
    declared in the main program.
    Exceptions:
    Our function module needs an exception that it can trigger if there are no entries
    in table SPFLI that meet the selection criterion. The exception NOT_FOUND
    serves this function.
    Source Code:
    Having defined the parameter interface and exceptions, we can now write the
    source code of our function module. To do this, choose Source code in the
    Function Builder. This opens the ABAP Editor for the include program
    L<fgrp>U<xx> (see Function Groups). This is the include that will
    hold the program code for the function module;
    Data in Function Modules
    You can use the TYPES and DATA statements to create local data types and
    objects. The interface parameters also behave like local data objects. In
    addition, you can access all of the global data of the main program. This data is
    defined in the include program L<fgrp>TOP. To open this include, choose Goto
      Global data. The global data behaves like the instance attributes of a class.
    The first time you call a function module in a particular function group, the data is
    loaded into memory. It can then be accessed and changed by all of the function
    modules in the group. The system retains the values until the next time a function
    module is called.
    Calling Subroutines
    You use subroutines for local modularization. Function modules can
    also use this technique. The function module that they call are defined in the
    corresponding main program.
    If you only want to call a subroutine from a single function module, it is best to
    define them in the same include program as the function module itself, directly
    after the ENDFUNCTION statement. These subroutines can be called from all
    function modules in the function group, but for clarity, they should only be called
    from the function module that precedes them.
    If you want to define a subroutine that will be called from several different function
    modules, you can define a special include program for it with the name
    L<fgrp>F<xx>.
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in
    function modules:
    RAISE <except>.
    and
    MESSAGE..... RAISING <except>.
    The effect of these statements depends on whether the calling program handles
    the exception or not. If the name <except> of the exception or OTHERS occurs
    in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is
    handled by the calling program.
    If the calling program does not handle the exception
      The RAISE statement terminates the program and switches to debugging mode.
      The MESSAGE ..... RAISING statement display the specified message. How the
    processing continues depends on the message type.
    If the calling program handles the exception, both statements return control to the
    program. No values are transferred. The MESSAGE ..... RAISING statement
    does not display a message. Instead, it fills the system fields SY-MSGID, SYMSGTY,
    SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
    Source Code of READ_SPFLI_INTO_TABLE
    The entire source code of READ_SPFLI_INTO_TABLE looks like this:
    FUNCTION READ_SPFLI_INTO_TABLE.
    ""Local interface:
    *" IMPORTING
    *" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
    *" EXPORTING
    *" VALUE(ITAB) TYPE SPFLI_TAB
    *" EXCEPTIONS
    *" NOT_FOUND
    SELECT * FROM SPFLI INTO TABLE ITAB WHERE CARRID = ID.
    IF SY-SUBRC NE 0.
    MESSAGE E007(AT) RAISING NOT_FOUND.
    ENDIF.
    ENDFUNCTION.
    The function module reads all of the data from the database table SPFLI where
    the key field CARRID is equal to the import parameter ID and places the entries
    that it finds into the internal table SPFLI_TAB. If it cannot find any entries, the
    exception NOT_FOUND is triggered using MESSAGE...RAISING. Otherwise, the
    table is passed to the caller as an exporting parameter.
    Regards,
    Chandru

Maybe you are looking for

  • Reg: passing totals /subtotals of a ALV to a smartform

    I have a editable ALV report which has a button to call a smartform . Once the user edits some  fields I need to pass the refreshed total to the smartform.  I want to know - in what structure the totals/subtotals  of the ALV report are stored.

  • New iPod touch just stopped playing videos

    I just got my iPod touch last night and it has been perfect till just now. The mail program froze and after I reset the iPod it won't play video. Not YouTube or ones I uploaded from iTunes. It stays on the opening image, has no sound and won't turn t

  • Open a link to a new page of the own website in a new window

    hi there i am working since a few weeks with iWeb and am in the process of making 3 websites. i have absolutely no idea of html and java script, and this is the main reason i use iWeb. i found a lot information in this forum - you guys are great. but

  • First virtual console not working

    I currently have semi-set my arch linux system, the only problem i'm having is that none of the virtual consoles are working. When i hit ctrl-alt-f1, all my monitor displays is "video mode not compatible". Last edited by dozerismydogsname (2010-02-15

  • How to access the pre-delivered XI Integration Content for APO ,SCM or CRM

    Guys, Do anyone know how to access the pre-delivered XI Integration Content for APO ,SCM or CRM and load onto the XI server. Any inputs in this direction is appreciated. Thanks, -Vara.