How I can create view with parameters?

I have very big query (2000 rows) and 2 parameters.
How I can create view with parameters?

If I use this small part of my query than I have error :
java.lang.NullPointerException
     at oracle.javatools.db.ora.OracleSQLQueryBuilder.buildQuery(OracleSQLQueryBuilder.java:199)
     at oracle.javatools.db.ora.OracleSQLQueryBuilder.buildQuery(OracleSQLQueryBuilder.java:147)
What does it means?
select
' Payroll ' as Revenue
, t.umonth, nvl(p.hmy, 0), nvl(t.sMTD, 0), nvl(a.inormalbalance, 0), nvl(T.sbudget, 0), nvl(a.scode, 0)
from
acct a, total t, property p, param par
where
nvl(t.hacct, 0) = nvl(a.hmy, 0)
and nvl(par.hretain, 0) <> nvl(a.hmy, 0)
and nvl(t.iBook, 0) = 0
and nvl(a.iacctType, 0) = 0 /*Regular accts*/
and nvl(t.hppty, 0) = nvl(p.hmy, 0)
and ( nvl(a.scode, 0) between 60000 and 6009000 )
union all ---------------------------------------------------------------------------------------------------------------------------------
select
' Payroll Taxes '
, t.umonth, nvl(p.hmy, 0), nvl(t.sMTD, 0), nvl(a.inormalbalance, 0), nvl(T.sbudget, 0), nvl(a.scode, 0)
from
acct a, total t, property p, param par
where
nvl(t.hacct, 0) = nvl(a.hmy, 0)
and nvl(par.hretain, 0) <> nvl(a.hmy, 0)
and nvl(t.iBook, 0) = 0
and nvl(a.iacctType, 0) = 0 /*Regular accts*/
and nvl(t.hppty, 0) = nvl(p.hmy, 0)
and
(nvl(a.scode, 0) between 60100 and 60690 )
union all -------------------------------------------------------------------------------------------------------------------------------
select
' Workers Comp/Disability '
, t.umonth, nvl(p.hmy, 0), nvl(t.sMTD, 0), nvl(a.inormalbalance, 0), nvl(T.sbudget, 0), nvl(a.scode, 0)
from
acct a, total t, property p, param par
where
nvl(t.hacct, 0) = nvl(a.hmy, 0)
and nvl(par.hretain, 0) <> nvl(a.hmy, 0)
and nvl(t.iBook, 0) = 0
and nvl(a.iacctType, 0) = 0 /*Regular accts*/
and nvl(t.hppty, 0) = nvl(p.hmy, 0)
and
( nvl(a.scode, 0) between 61200 and 61260)
union all -------------------------------------------------------------------------------------------------------------------------------
select
' Pension and Hospitalization '
, t.umonth, nvl(p.hmy, 0), nvl(t.sMTD, 0), nvl(a.inormalbalance, 0), nvl(T.sbudget, 0), nvl(a.scode, 0)
from
acct a, total t, property p, param par
where
nvl(t.hacct, 0) = nvl(a.hmy, 0)
and nvl(par.hretain, 0) <> nvl(a.hmy, 0)
and nvl(t.iBook, 0) = 0
and nvl(a.iacctType, 0) = 0 /*Regular accts*/
and nvl(t.hppty, 0) = nvl(p.hmy, 0)
and
( nvl(a.scode, 0) between 61000 and 61550 )
union all -------------------------------------------------------------------------------------------------------------------------------
select
' Other Labor Costs '
, t.umonth, nvl(p.hmy, 0), nvl(t.sMTD, 0), nvl(a.inormalbalance, 0), nvl(T.sbudget, 0), nvl(a.scode, 0)
from
acct a, total t, property p, param par
where
nvl(t.hacct, 0) = nvl(a.hmy, 0)
and nvl(par.hretain, 0) <> nvl(a.hmy, 0)
and nvl(t.iBook, 0) = 0
and nvl(a.iacctType, 0) = 0 /*Regular accts*/
and nvl(t.hppty, 0) = nvl(p.hmy, 0)
and
( nvl(a.scode, 0) between 616000 and 616400 )

Similar Messages

  • Is it possible to create views with parameters ?

    Hi,
    As MS-Access, is it possible to create views with parameters ?
    Ms-Access syntax : parameters [a] text; select * from table where code = [a]
    If yes, can you give samples ?
    Regards
    Pascal

    I suggest you you write a stored procedure that returns a recordset in oracle. Then execute the stored procedure and loop through the record set.
    Look in in MS Knowledgebase searching on ADO Stored Proceedures for the VB/C++/VBS .. code.
    Look in in Oracle PL/SQL guide for the Stored Proceedure code.

  • How i can create table with data

    How i can create table with data from dev to production?

    How i can create table with data
    [url=http://en.wikipedia.org/wiki/Black_Beast_of_Aa
    aaarrrrrrggghhh]from dev to production?
    [url=http://img2.travelblog.org/Photos/3800/14977/t
    /64816-Col-Kurtz-0.jpg]The horror, the
    horror.lol, you gonna scare somebody here.
    Are we helping devil?

  • Makes it possible to create view with parameters

    makes it possibel to create view with paramater, example
    create or replace view v_test(segment varchar2)
        select * from ref_user where segment = segmentThanks

    thanks..
    select count(distinct substr(a.svm_id,1,10)) jumlah " +
       " from daily_distribution_pop a, ref_toko b " +
       " where " +
       " substr(a.svm_id,1,10)=b.id and b.segment_type = 'A' and enable_flag='Y' " +
       " and a.tgl_visit between to_date('" + fromStartDate + "', 'dd/MM/yyyy') and to_date('" + fromEndDate + "', 'dd/MM/yyyy')
         and " + whereA + "= '" + whereB + "' " +
       " and substr(a.pom_id,1,2) = 'DP' and (a.qty_instore <> 0 or a.qty_delivered <> 0) ";
    {code}
    where fromStartDate,  fromEndDate, whereA, whereB  is variable parameter from asp.net.
    how to i can implement with view                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to run a View with parameters

    Hi guys,
    I have a view which has to take the USERNAME of the current user connected to the database as a parameter:
    Create or Replace View XYZ(A1,A2,A3)
    AS Select AA1, AA2, AA3
    from X1, X2
    where ...
    and X1.id_valid in (select XX3.id_valid
                   from X3 XX3
                   where XX3.ID_VALID = X1.id_valid
                   and XX3.username = USERNAME1 )
    Where USERNAME1 is the database user connected to it!.
    Could you give me a hand please?

    Just use the USER pseudocolumn ...
    create view v as
    select *
    from all_users
    where username = user;Richard

  • How to create a view with parameters; read the documentation but nothing!

    Hello!
    I'm new to the Oracle world but together with my coworkers we need to very quickly study Oracle to figure out whether we'll add Oracle to our list of supported databases or not.
    Question: How do I create a view with parameters?
    I've read the documentation but I could not find this! I found the sql syntax to create a view but no parameters whatsoever...
    I have found on the web some very complicated way of doing this, but doesn't Oracle support Views with parameters?
    The goal here is to return a recordset, don't forget, so,please don't speak about stored procedures unless you are going to tell me how to get a recordset out of a stored procedure! ;)
    Thanks for all your help and attention!
    Jorge C.

    You can set up a parameterized view via context as follows:
    1. Set up a procedure to set your context values:
    create or replace procedure p_set_context (p_context IN VARCHAR2,p_param_name IN VARCHAR2,p_value IN VARCHAR2)
    as
    BEGIN
    sys.dbms_session.set_context(p_context,p_param_name,p_value);
    END;
    2. Create your context using the procedure you just created
    create or replace context my_ctx using p_set_context
    3. This is the test table I'll use
    create table my_table(col1 number)
    and populate it:
    begin
    for v_index in 1..10
    loop
    insert into my_table values(v_index);
    end loop;
    end;
    and the view that will be parameterised
    create or replace view v_my_table as select col1 from my_table where col1 between sys_context('my_ctx','start_range') and sys_context('my_ctx','end_range')
    4. Now set the parameters using the procedure above.
    begin
    p_set_context('my_ctx','start_range','1');
    p_set_context('my_ctx','end_range','5');
    end;
    5. Selecting from my_table will give you 1 to 10 (no surprise there :-) )
    selectng from v_my_table will give you 1 to 5
    You can use the context to set formats etc using the same principle. A common gotcha to watch for is trying to set the context directly using DBMS_SESSION.SET_CONTEXT instead of creating a procedure. This belongs to SYS and SYS won't have the privileges to set your context so you get an insufficient privileges result leading to much headscratching and unnecessary grants (at least that's my understanding of it).
    Sorry Jorge, as you're new to Oracle I should also have pointed out for completeness sake, that you can change the parameters at any time through recalling the p_set_context, for example, following on from above, after your "select * from v_my_table" and seeing 1 to 5, you could then do
    begin
    p_set_context('my_ctx','start_range','3');
    end;
    and when you requery 'Select * from v_my_table' you will now see rows 3 to 5.
    Bit of a simplistic example, but you can see how easy it is. :-)
    Message was edited by:
    ian512

  • I would like to know how i can create a bell graph with out using sub VIs, the data that i created consists in 500 readings with values of 0 to 100, i calculated the mean value and standard diviation. I hope some one can help me

    I would like to know how i can create a bell graph with out using sub VIs, the data that i created consists in 500 readings with values of 0 to 100, i calculated the mean value and standard diviation. I hope some one can help me

    Here's a quick example I threw together that generates a sort-of-bell-curve shaped data distribution, then performs the binning and plotting.
    -Kevin P.
    Message Edited by Kevin Price on 12-01-2006 02:42 PM
    Attachments:
    Binning example.vi ‏51 KB
    Binning example.png ‏12 KB

  • How i can Create Master Repository with MySQL Database?

    How i can Create Master Repository with MySQL Database? i need to using MySQL Database to Master & Work Repository.
    I try to add mysql libary jar file to drivers . But , can't display MySQL Technology in Database List for Create Master Repository ?
    Please..
    Edited by: MadoatZ on Feb 19, 2011 1:47 AM

    Creation of ODI master repository is limited to few relational databases only. Check certification matrix for ODI 11g
    Oracle 10.2.0.4+
    Oracle 11.1.0.7+
    Oracle 11.2.0.1+
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    IBM DB2/UDB 9.7 and later FixPaks
    IBM DB2/400 (V5R4+)
    Hypersonic SQL 1.7.3+
    Sybase AS Enterprise 15.0.x
    thanks

  • How to create messages with parameters In ADF model.

    In ADF model, How to create messages with parameters?

    To Create messages in message bundles with parameters, perform the steps as given below
    Scenario: To Create a message as "Department Name XXXXXXX is already existing "
    Step#1: For the given entity object “DepartmentEO”, Go to “overview” tab and click “Business Rules” finger tab.
    Step#2: Select “Entity Validators” in the list & click “+” to add a new entity level validation rule.
    Step#3: Now go to “Failure Handling” tab, and click the Magnifier Icon.
    Step#4: Now in the “Display Value” field, enter the message with flower-braces as below.
    Department Name {department_name} is already existing
    Step#5: Also modify the Key & Description fields as needed. And click “Save and Select” button.
    Step#6: Now go to “Token Message Expressions” section, double-click the Expression field corresponding to "department_name" & give the relevant Attribute names say "DepartmentName"
    Step#7: Now click “OK”.

  • Create View  with Force and No Force

    Can Anyone Tell me how to create view with force and no force i have very little idea about this

    This is the syntax.
    CREATE [OR REPLACE] FORCE VIEW view
    [(alias[, alias]...)]
    AS subquery
    [WITH CHECK OPTION [CONSTRAINT constraint]]
    [WITH READ ONLY [CONSTRAINT constraint]];You can see interesting threads about this topic here.
    Re: Creating view forcibly
    Creating View forcefully
    Cheers
    Sarma.

  • What is meant by Local Class and how we can create local classes in abap?

    Hi Friends
    what is meant by Local Class and how we can create local classes in abap?
    Regards,
    Sree

    Hi
    Local classes are the classes which we declare and use using the SE38 ABAP editor
    Global classes are the classes which we find in SE24 and call the methods of them into our program.
    see the sample code
    REPORT zs_class.
    SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS:p_var TYPE i,
    p_var1 TYPE i.
    SELECTION-SCREEN END OF BLOCK b1.
    CLASS d_class DEFINITION
    CLASS d_class DEFINITION.
    PUBLIC SECTION.
    METHODS:
    add,
    sub.
    PROTECTED SECTION.
    DATA : var2 TYPE i.
    ENDCLASS. "d_class DEFINITION
    CLASS d_class IMPLEMENTATION
    CLASS d_class IMPLEMENTATION.
    METHOD add.
    var2 = p_var + p_var1.
    WRITE:/ var2.
    ENDMETHOD. "add
    METHOD sub.
    var2 = p_var - p_var1.
    WRITE:/ var2.
    ENDMETHOD. "sub
    ENDCLASS. "d_class IMPLEMENTATION
    START-OF-SELECTION
    START-OF-SELECTION.
    DATA: obj TYPE REF TO d_class.
    CREATE OBJECT: obj .
    CALL METHOD: obj->add,
    Regards
    Anji

  • How I can create a XML file from java Aplication

    How I can create a XML file from java Aplication
    whith have a the following structure
    <users>
    <user>
    <login>anyName</login>     
    <password>xxxx</password>
    </user>
    </users>
    the password label must be encripted
    accept any suggestion

    Let us assume you have all the data from the jsp form in an java bean object..
    Now you want a xml file. This can be acheived in 2 ways
    1. Write it into a file using java.io classes. Say you have a class with name
    write("<name>"+obj.getName+</name>);
    bingo you have a flat file with the xml
    2. Use data binding to do the trick
    will recommend JiBx and Castor for the 2nd option
    Regards,
    Rajagopal

  • Does anyone know how I can create "facing pages" in new Pages? I could do it in Pages 09, but can't find the option in new Pages.

    Does anyone know how I can create "facing pages" in new Pages? I could do it in Pages 09 but can't find the option in new Pages. I have documents created in Pages 09 and want to do some further work on them, but am now using new pages.

    There were 100+ features that didn't make it into the "new & improved, rewritten from the ground up” Pages 5. Some have returned with the updates & there are some new features that are worthwhile, but there are still 90+ features missing. Leave feedback for the Pages team using the link in the Pages menu and review & rate the new versions in the Mac App Store.
    If you previously had iWork '09, those apps are still in your Applications folder in a folder named iWork '09. You can continue to use them to get things done.

  • How i can create client copy

    how i can create client copy .
         pls tell me step by step procedure to create client.
             and client copy.

    For client copy login to source client with t-code scc4 and create the new client. Provide the details for new clients.
    Create the new logical client for new client.
    check for the the profile parameter
    login/no_automatic_user_sapstar = 0
    login to destination client with sap* and p/w as pass.
    run t-code sccl for local client copy with sap_all.
    Kindly provide the points if issue solve.
    Regards,
    Rohit mehta

  • How i can create animated slide show?

    How i can create animated slide show to my web sites listed bellow? Is Adobe PS suitble for it ?
    My websites are
    http://insurance-helpz.blogspot.com/
    http://www.autoinsurance-helpz.blogspot.com/
    You knowladge will help me to develop my sites with attractive slide show
    Thank you

    JJMack covers some possibilities, predicated on the embedded player in your Web site.
    You might want to look at another pair of Adobe programs, that work well together: Adobe Premiere Elements and Photoshop Elements. They are available in a bundle, and, if you do not have Photoshop Extended (up through CS 5.5), or Ps CS 6, or Ps CC, they cost MUCH less.
    One can create the SlideShow in the Organizer (sort of like Bridge, but with some differences), then can Send to Premiere Elements for final editing, such as the addition of Narration, or a Soundtrack. From PrE, one can then output to many, many different formats for linking to the player on the Web site.
    Now, if you have Ps Extended, Ps CS 6, or Ps CC already, you have video-editing capabilities, but some of the output options (and even Import options), will be limited.
    If searching for a program (or bundle of programs), then the Elements duo will do exactly what you need. Also, both of those programs have their own, very active forums, so you will have two communities to offer you support.
    Good luck,
    Hunt

Maybe you are looking for

  • Connection Pooling Questions

    Hi there, I was previously using the jferner/node-oracle module with the "generic-pool" (https://github.com/coopernurse/node-pool) module for connection pooling.  I'm trying out a setup with connection pooling with node-oracledb and have a few questi

  • Activated AT&T Pre3, wifi now, but App Catalog doesn't work?

    [copied here from Precentral post/thread: http://forums.precentral.net/hp-pre-3/303421-activated-t-pre3-wifi-now-but-app-catalog-doesnt-work.h... ] Hey there, Just a couple of days ago, with a borrowed AT&T SIM, I activated a GSM Pre3, creating a new

  • Urgent ! help ! Pop-up panel invalidates graph cursor to snap to plot point.

    I used PlotXY in the graph control with cursor attribute of '"sanp to point" and produced a plot. Everything is OK before popup a pop-up panel. After the pop-up panel removed, the cursor can't snap to any point of the plot. I tried "SetPlotAttribute

  • Why do I get an error when the code is working?

    Hi guys, I get an error on the 'employeeList[i].id' and 'employeeList[i].label'. Though everything works when I click the 'Search Button' (all text fields populate with the correct data).... but I still get an 1010 error. Any idea's why? search_txt =

  • SCSM Exchange Connector not recognizing custom Service Request prefix

    Hello, We have an Orchestrator runbook that brings over "Projects" from our Financial system into Service Manager as Service Request.   As a way to distinguish these as projects we changed the prefix from the default "SR" to "PT".  In all out testing