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

Similar Messages

  • How to create a view with parameter?

    who can tell me hwo to create a view with
    parameters just like a cursor?

    Hi,
    This is not possible in Oracle. What u can do is create the view without the where clasue and supply the where clause at runtime.
    Hope this helps...
    Regards,
    Ganesh R

  • How to create table view with reference table

    Hi experts,
    How to create table view with reference table in SE11, plz gve me stp by stp procedure.
    pints grnded for hlp.

    Hi
    Go to Tcode se11 choose view and enter the name and create a popup opens up choose database view option
    enter the description
    On the left hand side choose the table name.
    Click on view fields tab and choose your table fields.Here you can choose which fields you want in your view.
    Save and then activate.
    Hope this helps.
    Regards,
    Harish

  • How to create a view with a column of counts of the occurence of values

    If my table is:
    ID
    1
    2
    3
    3
    5
    5
    5
    I want to create a view with the following result:
    ID   COUNT
    1     1
    2     1
    3     2
    5     3
    How would I accomplish this?

    Sorry, my mistake. I was thinking about counting distinct events.
    I created a table with your example values:
    You should do a projection with a calculated column = 1:
    And then add this calculated column as an aggregated measure on the aggregation node:
    Result:
    Cheers,
    Fernando

  • How to create a view with Oracle apps Org initialization ?

    Hi,
    How to create a view which needs Oracle apps org initialization to provide the correct data .
    The purpose of the view is to be accessed in Primavera DB via a DB link for reporting purpose.
    So how should the org be initialized so that the view returns the correct data when accessed from the remote data base using the DB link?
    EX: step1 run fnd_client_info.set_org_context for the org
    step2 query the veiw returns correct data in Oracle.
    How can this be achieved if the view needs to be accessed via DB link?
    sample view sql :
    select po_header_id
    from po_distributions_all pod
    where (apps.po_intg_document_funds_grp.get_active_encumbrance_func
    ('PO',
    pod.po_distribution_id
    ) <> 0
    Thanks in advance!
    Darshini

    Hi,
    This is not possible in Oracle. What u can do is create the view without the where clasue and supply the where clause at runtime.
    Hope this helps...
    Regards,
    Ganesh R

  • How to create a view with columns from multiple rows

    I have posted this in SQL/PSL forum, but I hope database experts in this group can give me ideas too, also the need is from BI reports.
    I have a table, say, project_milestones, which has these columns in concern:
    proj_id, milestone_name, actual_end_date
    with data:
    proj_id, milestone_name, actual_end_date
    ===== ================ ==============
    1001, Key Element Approve, 2009-10-02
    1001, Final Synopsis, 2009-10-07
    1001, Final Protocol Approved, 2009-10-15
    1001, FPFV, 2010-01-10
    1001, LPFV, 2010-03-12
    1002, Key Element Approve, 2008-12-02
    1002, Final Synopsis, 2009-01-07
    1002, Final Protocol Approved, 2009-01-12
    1002, FPFV, 2009-03-30
    1002, LPFV, 2009-10-04
    There are about 10 milestones in each project.
    I have to create a view to flat these data at project level, looks like this:
    proj_id, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days, ....
    How can I do this?
    Thanks,

    user9175541 wrote:
    I have posted this in SQL/PSL forum, but I hope database experts in this group can give me ideas too, also the need is from BI reports.
    I have a table, say, project_milestones, which has these columns in concern:
    proj_id, milestone_name, actual_end_date
    with data:
    proj_id, milestone_name, actual_end_date
    ===== ================ ==============
    1001, Key Element Approve, 2009-10-02
    1001, Final Synopsis, 2009-10-07
    1001, Final Protocol Approved, 2009-10-15
    1001, FPFV, 2010-01-10
    1001, LPFV, 2010-03-12
    1002, Key Element Approve, 2008-12-02
    1002, Final Synopsis, 2009-01-07
    1002, Final Protocol Approved, 2009-01-12
    1002, FPFV, 2009-03-30
    1002, LPFV, 2009-10-04
    There are about 10 milestones in each project.
    I have to create a view to flat these data at project level, looks like this:
    proj_id, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days, ....
    How can I do this?
    Thanks,Create a pivot table and put "milestone_name" in the Columns section under the Labels.
    Put "actual_end_date" in the Measures section and change the Aggregation Rule to "Max."
    The rest of the attributes keep in Rows section.

  • How to create materialized  view with parameter and index ?

    Hi all,
    i am using oracle 11g.
    i want to create  parameter materialized view  with two parameter (STORED_VALUE, LOV_NAME) with  an index .
    i have below view
    CREATE OR REPLACE FORCE VIEW SR_MY_TEST(DISPLAYED_VALUE, STORED_VALUE, LOV_NAME) AS
      SELECT  DISPLAYED_VALUE , LOVVALUE.STORED_VALUE , lovname.lov_name
               FROM (SELECT T.LOV_VALUE_ID,
          T.LOV_ID,
          T.ORG_ENTITY_ID,
          T.STORED_VALUE,
          T.DISPLAYED_VALUE,
          T.ENTERPRISE_ID
         FROM MS_QS_LIST_OF_VALUES_T T) lovvalue, ms_qs_lov_names lovname
              WHERE lovvalue.lov_id = lovname.lov_id
                AND lovvalue.org_entity_id = 1
                and LOVVALUE.ENTERPRISE_ID = 100000
                AND LOVNAME.ENTERPRISE_ID = 100000;
    i want to create index on   STORED_VALUE, LOV_NAME
    Thanks
    Damby

    No.AFAIK, there's nothing called as "parameterized MV".
    Materialized View store data like tables (and not like Views). So, does it make sense when you say - "table with parameters" ?
    Could you please explain your business requirement?
    What is the purpose behind those 2 parameters?

  • How to create a PDF with Only Read Property

    Hello Gurus,
    I have a big question:
    How can I create an Smartform which can be exported in an Only Read PDF ?
    I need to do that for creating a PDF file which information can not be copied.
    Is that Possible?
    Thanks!!!
    rgds.
    Miguel Angel.

    Hi,
    the nature of a PDF file is that it cannot be modified, only read with Adobe Reader, and not only once downloading the form from SAP but with any tool. What you pretend is impossible, because there are many tools in the market for making the PDF files either editable or per Copy + paste you can process the texts in Word or any software.
    Search in the internet (www.download.com) if there´s a software that can lock your file, but I am sure that this will not work in conjunction with SAP during generation of file; it´s going to be a manual work.

  • How to create OMPplus script with parameters

    Hi all. I am trying to parameterize my OMB scripts. For now I am only able to pass one type of parameter, For example in the script below I can parameterize the mapping name. So even If I pass 3 mapping names I will import MDX files and deploy for all 3 mappings.
    I want to improve this and I want to pass other parameters such as passwords and schema names also. How would I be able to do that? How can I pass different type of parameters such as schema name, password and mapping name and reference to them separately from the script?
    set MAPLIST $argv
    OMBCONOMBCONNECT DWPROD/DWPROD@cakir:1521:orcl USE REPOSITORY 'OWBDB_SYS'OMBCC 'MY_PROJECT'
    OMBCONNECT CONTROL_CENTER
    OMBCOMMIT
    foreach mapName $MAPLIST {
    OMBIMPORT MDL_FILE 'C:/tfsroot2/Interfaces and Extracts/branches/Interfaces and Extracts1.1/000 - OWB Prototype/deploy/ora.stg/mappings/$mapName.mdx' USE UPDATE_MODE MATCH_BY NAMES OUTPUT LOG TO 'C:/tfsroot2/Interfaces and Extracts/branches/Interfaces and Extracts1.1/000 - OWB Prototype/deploy/ora.stg/mappings/$mapName.log'
    OMBCOMMIT
    OMBALTER LOCATION 'XTRCT_DWEXTRACT_LOC' SET PROPERTIES (PASSWORD) VALUES ('PASSWORD')
    OMBALTER ORACLE_MODULE 'XTRCT_DWEXTRACT' ADD REFERENCE LOCATION 'XTRCT_DWEXTRACT_LOC' SET AS DEFAULT
    OMBALTER ORACLE_MODULE 'XTRCT_DWEXTRACT' SET PROPERTIES (DB_LOCATION) VALUES ('XTRCT_DWEXTRACT_LOC')
    OMBCOMMIT
    OMBALTER LOCATION 'XTRCT_DWPROD_LOC' SET PROPERTIES (PASSWORD) VALUES ('PASSWORD')
    OMBALTER ORACLE_MODULE 'XTRCT_DWPROD' ADD REFERENCE LOCATION 'XTRCT_DWPROD_LOC' SET AS DEFAULT
    OMBALTER ORACLE_MODULE 'XTRCT_DWPROD' SET PROPERTIES (DB_LOCATION) VALUES ('XTRCT_DWPROD_LOC')
    OMBCOMMIT
    OMBREGISTER LOCATION 'XTRCT_DWEXTRACT_LOC'
    OMBCOMMIT
    OMBREGISTER LOCATION 'XTRCT_DWPROD_LOC'
    OMBCOMMIT
    OMBREGISTER LOCATION 'DWEXTRACT_INPUT'
    OMBCOMMIT
    OMBREGISTER LOCATION 'DWEXTRACT_OUTPUT'
    OMBCOMMIT
    OMBCC 'XTRCT_DWEXTRACT'
    foreach mapName $MAPLIST {
    OMBCREATE TRANSIENT DEPLOYMENT_ACTION_PLAN '$mapName' ADD ACTION 'MAPPING_DEPLOY' SET PROPERTIES (OPERATION) VALUES ('CREATE') SET REFERENCE MAPPING '$mapName'
    OMBDEPLOY DEPLOYMENT_ACTION_PLAN '$mapName'
    OMBDROP DEPLOYMENT_ACTION_PLAN '$mapName'
    OMBCOMMIT
    puts "Mapping $mapName deployed"
    OMBDISCONNECT

    Maybe you can try putting this variable list of parameters in a text file and read the text file. You pass the path/name of the text file as a variable:
    proc read_file { p_file } {
    # Validate file exists
    if { [ file exists $p_file ] } {
    puts "File: $p_file exists"
    } else {
    puts "ERROR, not exists: $p_file"
    return 1
    # open file to read
    set v_openfile [ open "$p_file" ]
    set data_file [ read -nonewline $v_openfile ]
    close $v_openfile
    # read each line in file
    set v_list_line [ split $data_file \n ]
    foreach v_line $v_list_line {
    Regards
    ANA GH

  • How to create a view  with "WITH CLAUSE"

    Hi,
    I have a query with "WITH" CLAUSE , I need to create a view on this query. But I am getting error like
    ORA-32034 : Unsupported sue of WITH clause.
    Please help me...!!
    Please find below my query...!!
    WITH RANGE
             AS (SELECT A.MASTERMACHINEID,
                        a.startdate,
                        a.enddate,
                        a.startdate - (1 / 3) + (lvl) * 1 / 3 SHIFT_ST_DT,
                        a.startdate + (lvl) * 1 / 3 AS SHIFT_END_DT,
                        a.quantity,
                        (LEAST ( enddate, TODATE) - GREATEST ( FROMDATE, startdate)) * 24 TOTAL_HRS,
                        (enddate - startdate) * 24 AVAIL,
                       todate,
                       fromdate
                  FROM OMP A,
                       (SELECT LEVEL lvl
                          FROM (SELECT MAX (enddate - startdate) AS diff FROM OMPWORKORDER)
                        CONNECT BY LEVEL <= (diff) * 3),
                       MASTER B
                 WHERE A.MASTERMACHINEID = B.MASTERMACHINEID
                   AND lvl / 3 <=(enddate - startdate) + 1
                ORDER BY SHIFT_ST_DT)
       SELECT shift_date,
              shift_num,
              shift_hrs,
              DECODE (SIGN (SHUT_DWN_TIME), -1, 0, SHUT_DWN_TIME),
              8 - DECODE (SIGN (SHUT_DWN_TIME), -1, 0, SHUT_DWN_TIME) shift_avail_hrs,
              qty,
              total_qty
         FROM (SELECT TRUNC (SHIFT_ST_DT) shift_date,
                      ROW_NUMBER () OVER (PARTITION BY TRUNC (SHIFT_ST_DT) ORDER BY SHIFT_ST_DT) shift_num,
                      8 shift_hrs,
                      (LEAST ( SHIFT_END_DT, TODATE) - GREATEST ( FROMDATE, SHIFT_ST_DT)) * 24
                        SHUT_DWN_TIME,
                      quantity / (avail - TOTAL_HRS) qty,
                      round(((SHIFT_END_DT - SHIFT_ST_DT) * 24 - (LEAST (SHIFT_END_DT, TODATE) - GREATEST (FROMDATE, SHIFT_ST_DT)) * 24)  * QuantiTY / (AVAIL - TOTAL_HRS),2)
                         TOTAL_QTY
                 FROM RANGE A );Regards
    KPR
    Edited by: BluShadow on 17-Mar-2011 09:48
    added {noformat}{noformat} tags for readability                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Try creating view on following query, if it can help you:
    SELECT shift_date,
        shift_num,
        shift_hrs,
        decode(SIGN(shut_dwn_time),     -1,     0,     shut_dwn_time),
        8 -decode(SIGN(shut_dwn_time),     -1,     0,     shut_dwn_time) shift_avail_hrs,
        qty,
        total_qty
    FROM
            SELECT TRUNC(shift_st_dt) shift_date,
                 row_number() over(PARTITION BY TRUNC(shift_st_dt)
             ORDER BY shift_st_dt) shift_num,
                 8 shift_hrs,
                (least(shift_end_dt,      todate) -greatest(fromdate,      shift_st_dt)) *24 shut_dwn_time,
                 quantity /(avail -total_hrs) qty,
                 ROUND(((shift_end_dt -shift_st_dt) *24 -(least(shift_end_dt,      todate) -greatest(fromdate,      shift_st_dt)) *24) *quantity /(avail -total_hrs),      2) total_qty
             FROM
                  SELECT a.mastermachineid,
                     a.startdate,
                     a.enddate,
                     a.startdate -(1 / 3) +(lvl) *1 / 3 shift_st_dt,
                     a.startdate +(lvl) *1 / 3 AS
                 shift_end_dt,
                     a.quantity,
                    (least(enddate,      todate) -greatest(fromdate,      startdate)) *24 total_hrs,
                    (enddate -startdate) *24 avail,
                     todate,
                     fromdate
                 FROM omp a,
                        (SELECT LEVEL lvl
                     FROM
                        (SELECT MAX(enddate -startdate) AS
                        diff
                         FROM ompworkorder)
                    CONNECT BY LEVEL <=(diff) *3),
                     master b
                 WHERE a.mastermachineid = b.mastermachineid
                 AND lvl / 3 <=(enddate -startdate) + 1
                 ORDER BY shift_st_dt
             ) a
    ;Regards,
    Dipali.l

  • How To Create Table View With Same Column name But Different Table?

    Hi All,
    I have the problem to create a tableview with same column name but in different table.
    The Table that i have:-
    Table - PAC051MPROFORMA
    Column - mrn,visitid
    Table - PAC051TPROFORMA
    Column - mrn,visitid
    Table - PAC052MTRANSBILL
    Column - mrn,visitid
    Then i want to create a table view to view that table. This is my SQL
    CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
    As Select PAC051MPROFORMA.mrn,PAC051MPROFORMA.visitid,PAC051TPROFORMA.mrn,PAC051TPROFORMA.visitid,PAC052MTRANSBILL.mrn,PAC052MTRANSBILL.visitid
    where
    *(a.PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)*
    and
    *(a.PAC051TPROFORMA.mrn=PAC052TRANSBILL.mrn)*
    That SQL Return this error = ORA-00957: duplicate column name
    Then I modify that SQL to
    CREATE VIEW pacviewproforma (mrn,visitid)
    As Select PAC051MPROFORMA.mrn,PAC051MPROFORMA.visitid,PAC051TPROFORMA.mrn,PAC051TPROFORMA.visitid,PAC052MTRANSBILL.mrn,PAC052MTRANSBILL.visitid
    where
    *(a.PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)*
    and
    *(a.PAC051TPROFORMA.mrn=PAC052TRANSBILL.mrn)*
    This time this error return = ORA-01730: invalid number of column names specified
    What should i do?
    Thanks...

    Hi,
    SQL> CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
      2  As Select
      3  PAC051MPROFORMA.mrn,
      4  PAC051MPROFORMA.visitid,
      5  PAC051TPROFORMA.mrn,
      6  PAC051TPROFORMA.visitid,
      7  PAC052MTRANSBILL.mrn,
      8  PAC052MTRANSBILL.visitid
      9  from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
    10  where
    11  (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
    12  and
    13  (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
    CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
    ERROR at line 1:
    ORA-00957: duplicate column namePlease give different names to each column.
    Something like this..
    SQL> CREATE OR REPLACE VIEW pacviewproforma (MPROFORMA_mrn,MPROFORMA_visitid,TPROFORMA_mrn,TPROFORMA
    _visitid,MTRANSBILL_mrn,MTRANSBILL_visitid)
      2  As Select
      3  PAC051MPROFORMA.mrn,
      4  PAC051MPROFORMA.visitid,
      5  PAC051TPROFORMA.mrn,
      6  PAC051TPROFORMA.visitid,
      7  PAC052MTRANSBILL.mrn,
      8  PAC052MTRANSBILL.visitid
      9  from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
    10  where
    11  (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
    12  and
    13  (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
    View created.
    SQL> DESC  pacviewproforma;
    Name                                      Null?    Type
    MPROFORMA_MRN                                      NUMBER
    MPROFORMA_VISITID                                  NUMBER
    TPROFORMA_MRN                                      NUMBER
    TPROFORMA_VISITID                                  NUMBER
    MTRANSBILL_MRN                                     NUMBER
    MTRANSBILL_VISITID                                 NUMBER
    ORA-01730: invalid number of column names specifiedThe list of column nmae you specified during the CREATE VIEW should match with the SELECT list of the view.
    Twinkle

  • How to create a report with data using the Crystal Reports for Java SDK

    Hi,
    How do I create a report with data that can be displayed via the Crystal Report for Java SDK and the Viewers API?
    I am writing my own report designer, and would like to use the Crystal Runtime Engine to display my report in DHTML, PDF, and Excel formats.  I can create my own report through the following code snippet:
    ReportClientDocument boReportClientDocument = new ReportClientDocument();
    boReportClientDocument.newDocument();
    However, I cannot find a way to add data elements to the report without specifying an RPT file.  Is this possible?  I seems like it is since the Eclipse Plug In allows you to specify your database parameters when creating an RPT file.
    is there a way to do this through these packages?
    com.crystaldecisions.sdk.occa.report.data
    com.crystaldecisions.sdk.occa.report.definition
    Am I forced to create a RPT file for the different table and column structures I have? 
    Thank you in advance for any insights.
    Ted Jenney

    Hi Rameez,
    After working through the example code some more, and doing some more research, I remain unable to populate a report with my own data and view the report in a browser.  I realize this is a long post, but there are multiple errors I am receiving, and these are the seemingly essential ones that I am hitting.
    Modeling the Sample code from Create_Report_From_Scratch.zip to add a database table, using the following code:
    <%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
    <%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
    <%
    try { 
                ReportClientDocument rcd = new ReportClientDocument();
                rcd.newDocument();
    // Setup the DB connection
                String database_dll = "Sqlsrv32.dll";
                String db = "qa_start_2012";
                String dsn = "SQL Server";
                String userName = "sa";
                String pwd = "sa";
                // Create the DB connection
                ConnectionInfo oConnectionInfo = new ConnectionInfo();
                PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();
                // Set new table logon properties
                PropertyBag oPropertyBag2 = new PropertyBag();
                oPropertyBag2.put("DSN", dsn);
                oPropertyBag2.put("Data Source", db);
                // Set the connection info objects members
                // 1. Pass the Logon Properties to the main PropertyBag
                // 2. Set the Server Description to the new **System DSN**
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, oPropertyBag2);
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, dsn);
                oPropertyBag1.put("Database DLL", database_dll);
                oConnectionInfo.setAttributes(oPropertyBag1);
                oConnectionInfo.setUserName(userName);
                oConnectionInfo.setPassword(pwd);
                // The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).
                oConnectionInfo.setKind(ConnectionInfoKind.CRQE);
    // Add a Database table
              String tableName = "Building";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
        catch(ReportSDKException RsdkEx) {
                out.println(RsdkEx);  
        catch (Exception ex) {
              out.println(ex);  
    %>
    Throws the exception
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
    There was other sample code on SDN which suggested the following - adding the table after calling table.setDataFields() as in:
              String tableName = "Building";
                String fieldname = "Building_Name";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setAlias(tableName);
                oTable.setQualifiedName(tableName);
                oTable.setDescription(tableName) ;
                Fields fields = new Fields();
                DBField field = new DBField();
                field.setDescription(fieldname);
                field.setHeadingText(fieldname);
                field.setName(fieldname);
                field.setType(FieldValueType.stringField);
                field.setLength(40);
                fields.add(field);
                oTable.setDataFields(fields);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
    This code succeeds, but it is not clear how to add that database field to a section.  If I attempt to call the following:
    FieldObject oFieldObject = new FieldObject();
                oFieldObject.setDataSourceName(field.getFormulaForm());
                oFieldObject.setFieldValueType(field.getType());
                // Now add it to the section
                oFieldObject.setLeft(3120);
                oFieldObject.setTop(120);
                oFieldObject.setWidth(1911);
                oFieldObject.setHeight(226);
                rcd.getReportDefController().getReportObjectController().add(oFieldObject, rcd.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0), -1);
    Then I get an error (which is not unexpected)
    com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The field was not found.---- Error code:-2147213283 Error code name:invalidFieldObject
    How do I add one of the table.SetDataFields()  to my report to be displayed?
    Are there any other pointers or suggestions you may have?
    Thank you

  • How to create a list with "Chapter" before the numbering ?

    Hello Apple Support Communities.
    I would like to create a automatic list in Pages with "Chapter" or "Part" set before the numbering.
    Exemple:
              Chapter 1. Blabla
                   Part A. Blabla
              Chapter 2. Blabla
    Thanks

    Ok, I managed to create a Text Bullet "Chapter" in level 1 but how can I join the numbering at level 2 on the same line ?
    Pierre

  • How to create a SelectItem with image before the label text?

    How to create SelectItems with image before the label text for selectMulitpleChoice, selectOneChoice, selectOrderShutltle, etc?

    you have to create a custom selectoechoice for this.. to have an image next to the seelct items..
    as mentioned above..
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/55-selectonechoicewithimages-170420.pdf

  • How to create analytic view with tables  VBRK VBRP KONV ?

    Hi Gurus,
    What is the best way to combine in a analytic view tables VBRK VBRP and KONV for better optimization or
    how to make the relationship tables VBRK VBRP KONV with better performance in Hana Studio ?
    This analytic view should be used in a calculation view to the final calculations.
    Thanks !

    Hi Rogerio,
    Greetings.
    Basically , when you design your analytic views , while designing your data foundation , you can directly join the tables with the corresponding key attributes . Analytic views are capable of optimizing the join operation when we access the view.Logic of joining is purely depends on your business requirement
    Sreehari.

Maybe you are looking for

  • No sound on youtube in chrome

    I'm getting no sound when playing YouTubes and other videos using the chrome browser.  Is there anything I can do?  Chrome bundles the flash player and it has not been disabled.  Thanks for any help.

  • Messed up permissions

    Over the last day I have multiple problems develop that may or may not be related. I downloaded a plugin (Boris FX) for Adobe Premiere Pro but have had a lot of trouble installing it. Sine then Premiere Pro now constantly crashes citing a generic err

  • IWork not coming up free in app store even with newest ios7.0.3 installed

    We just installed the latest version of ios7.0.3 on our 3 and a half month old ipad mini, yet when I go to the app store, iWork still comes up as $9.99 per app rather than free. I am not sure what I am doing wrong. Any advice would be greatly appreci

  • HT4009 Having some problems..

    i just bought a 50$ prepaid itunes card, amd i bought something in-app and, now i have missing money on my account and i don't have the in-app purchase, what should i do ? please help me , thanks

  • IPod touch restore error 2001

    Hello, i have troubles with my iPod touch. It ran out of battery and would not charge  So i decided to restore it and the "2001errors appers. I have my iTunes and Mac up to date. Anybody can help me? thanks