ROWNUM, Cursor, and Paged Reports

I am using ASP against a Oracle 8i DB in a web application. I have some large reports (approx 2,000 records) that I need to display on the site in a paged style report. i.e. 25 records on page 1, 26-50 on page 2, etc...... Much like you see here at OTN in the forums.
The problem is that when I go through the the ADO to build my recordset against the DB, I need to be able to select just a certain set of rownumbers. I will also need to be able to reorder the report based on client response. I know that the ROWNUM psudeofield is filled before any sort criteria is applied through the order by clause. So if I select against the view, how will I tell it to give me the next set of records that will make up my page. A oracle book I have says to use the cursor object to do this, but I am not really familiar with that, and from what I can see, it still didn't tell me how to select just a small part of the overall recordset that might be returned to the cursor by the SQL statement.
Does any of this make sense? And if so, can someone please point me to a good source of information on how to do this. I know it has to be possible, becuase sites have that ability all over the place, but as I might be changing from ASP to JSP soon, I don't really want to do it all in code,becuase then I have to rewrite that as well. Doing this on the database is really my only good option.

Here is an example, that uses the Oracle emp demo table to demonstrate how to use a ref cursor to return a result set ordered by whatever columns you want and get any set of rows you want. In the example, I first ordered by the empno column and retrieved the first 10 rows, then the next set of 10 rows (there are only 14 rows, so it just displays 4 more rows). Then I ordered by the ename column and retrieved 5 rows at a time. You can specify any number or combination of columns and any starting or ending rows you want.
SQL> CREATE OR REPLACE PACKAGE package_name
  2  AS
  3    TYPE cursor_type IS REF CURSOR;
  4    PROCEDURE procedure_name
  5      (p_result_set    IN OUT cursor_type,
  6       p_order_by      IN     VARCHAR2,
  7       p_start_row     IN     NUMBER,
  8       p_end_row       IN     NUMBER);
  9  END package_name;
10  /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY package_name
  2  AS
  3    PROCEDURE procedure_name
  4      (p_result_set    IN OUT cursor_type,
  5       p_order_by      IN     VARCHAR2,
  6       p_start_row     IN     NUMBER,
  7       p_end_row       IN     NUMBER)
  8    IS
  9      v_sql                   VARCHAR2 (4000);
10    BEGIN
11      v_sql :=
12          'SELECT *'
13      || ' FROM   (SELECT ROWNUM AS r, a.*'
14      ||         ' FROM   (SELECT   * '
15      ||                 ' FROM     emp'
16      ||                 ' ORDER BY ' || p_order_by || ') a'
17      ||         ' WHERE  ROWNUM <= :p_end_row )'
18      || ' WHERE    r >= :p_start_row';
19      OPEN p_result_set FOR v_sql USING p_end_row, p_start_row;
20    END procedure_name;
21  END package_name;
22  /
Package body created.
SQL> SET LINESIZE 125
SQL> VARIABLE g_ref REFCURSOR
SQL> -- to get first ten rows ordered by empno:
SQL> EXEC package_name.procedure_name (:g_ref, 'EMPNO', 1, 10)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
         R      EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
         1       7369 SMITH      CLERK           7902 17-DEC-80        800                    20
         2       7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
         3       7521 WARD       SALESMAN        7698 22-FEB-81       1250     505.07         30
         4       7566 JONES      MANAGER         7839 02-APR-81       2975                    20
         5       7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
         6       7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
         7       7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
         8       7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
         9       7839 KING       PRESIDENT            17-NOV-81       5000                    10
        10       7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
10 rows selected.
SQL> -- to get second ten rows ordered by empno:
SQL> EXEC package_name.procedure_name (:g_ref, 'EMPNO', 11, 20)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
         R      EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
        11       7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
        12       7900 JAMES      CLERK           7698 03-DEC-81        950                    30
        13       7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
        14       7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
SQL> -- to get first five rows ordered by ename:
SQL> EXEC package_name.procedure_name (:g_ref, 'ENAME', 1, 5)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
         R      EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
         1       7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
         2       7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
         3       7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
         4       7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
         5       7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
SQL> -- to get second five rows ordered by ename:
SQL> EXEC package_name.procedure_name (:g_ref, 'ENAME', 6, 10)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
         R      EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
         6       7900 JAMES      CLERK           7698 03-DEC-81        950                    30
         7       7566 JONES      MANAGER         7839 02-APR-81       2975                    20
         8       7839 KING       PRESIDENT            17-NOV-81       5000                    10
         9       7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
        10       7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
SQL> -- to get third set of five rows ordered by ename:
SQL> EXEC package_name.procedure_name (:g_ref, 'ENAME', 11, 15)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
         R      EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
        11       7788 SCOTT      ANALYST         7566 09-DEC-82       3000                    20
        12       7369 SMITH      CLERK           7902 17-DEC-80        800                    20
        13       7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
        14       7521 WARD       SALESMAN        7698 22-FEB-81       1250     505.07         30

Similar Messages

  • Report based on Ref Cursor and lock package/table (ORA-04021)

    Hi,
    I have reports based on Ref Cursor. Report builder and Reports Background Engine make pins for package, which consist of Ref Cursor, and for tables, which is used in package. So I can't grant any privileges on these tables anybody.
    For example, after next statement:
    GRANT SELECT ON table_name TO user_name
    I received the next error:
    ORA-04021: timeout occurred while waiting to lock object table_name
    Thanks

    Hi,
    I have reports based on Ref Cursor. Report builder and Reports Background Engine make pins for package, which consist of Ref Cursor, and for tables, which is used in package. So I can't grant any privileges on these tables anybody.
    For example, after next statement:
    GRANT SELECT ON table_name TO user_name
    I received the next error:
    ORA-04021: timeout occurred while waiting to lock object table_name
    Thanks

  • Report based on Ref Cursor and grant privileges

    Hi,
    I have reports based on Ref Cursor. Report builder and Reports Background Engine make pins for package, which consist of Ref Cursor, and for tables, which is used in package. So I can't grant any privileges on these tables anybody.
    For example, after next statement:
    GRANT SELECT ON table_name TO user_name
    I received the next error:
    ORA-04021: timeout occurred while waiting to lock object table_name
    Thanks

    Hi,
    I have reports based on Ref Cursor. Report builder and Reports Background Engine make pins for package, which consist of Ref Cursor, and for tables, which is used in package. So I can't grant any privileges on these tables anybody.
    For example, after next statement:
    GRANT SELECT ON table_name TO user_name
    I received the next error:
    ORA-04021: timeout occurred while waiting to lock object table_name
    Thanks

  • Ref cursor and dynamic sql

    Hi..
    I'm using a ref cursor query to fetch data for a report and works just fine. However i need to use dynamic sql in the query because the columns used in the where condition and for some calculations may change dynamically according to user input from the form that launches the report..
    Ideally the query should look like this:
    select
    a,b,c
    from table
    where :x = something
    and :y = something
    and (abs(:x/:y........)
    The user should be able to switch between :x and :y
    Is there a way to embed dynamic sql in a ref cursor query in Reports 6i?
    Reports 6i
    Forms 6i
    Windows 2000 PRO

    Hello Nicola,
    You can parameterize your ref cursor by putting the query's select statement in a procedure/function (defined in your report, or in the database), and populating it based on arguments accepted by the procedure.
    For example, the following procedure accepts a strongly typed ref cursor and populates it with emp table data based on the value of the 'mydept' input parameter:
    Procedure emp_refcursor(emp_data IN OUT emp_rc, mydept number) as
    Begin
    -- Open emp_data for select all columns from emp where deptno = mydept;
    Open emp_data for select * from emp where deptno = mydept;
    End;
    This procedure/function can then be called from the ref cursor query program unit defined in your report's data model, to return the filled ref cursor to Reports.
    Thanks,
    The Oracle Reports Team.

  • Drilldown and interactive reports

    hi,
    is there any difference between drilldown and interactive reports.
    if there exits , what is the difference?
    kindly help me.
    i will reward good points.
    regards
    thiru

    1. There is NO diff btw    Interactive and Drilldown.
    2. get cursor.
    get cursor field <field_name>  value <field_value>.
    when you double clik on any line in list..reads particular field instead of whole line (where you clicked).
    3. Hide statement.
    hides contents of fields to make availble to further list processing
    press F1 on HIDE you'll get more info...

  • Difference between diadem and LabVIEW Report Generation Toolkit

    I want to expand LabVIEW's reporting capabilities.  Can someone tell me what the difference is between DIAdem and the LabVIEW Report Generation Toolkit for Microsoft Office.

    Hello Mr Bean,
    There are several major differences between the two solutions. I'll try and outline them as good as I can ...
    The biggest different is that LabVIEW and its toolkits are programming tools and DIAdem is a ready to run application.
    The LabVIEW Report Generation Toolkit basically provides an extensive library of VIs that allow you to connect LabVIEW to the MS Office library and create and edit reports in Word and Excel.
    DIAdem is a stand alone application that was designed to post-process data from various sources. The tools included in DIAdem are:
    1. NAVIGATOR: Allows you to import data from files (ASCII, binary, Excel, etc.) as well as DataBases (SQL/ODBC, Citadel, ASAM, etc.). The unique DataPlugin technology available within DIAdem allows you to import vitually and data file by creating a DataPlugin that describes the data format and gets linked to DIAdem. More information at: http://www.ni.com/diadem/dataplugins.htm
    2. VIEW: Graphical and Numerical data inspection tool. Use cursors to zoom and scroll through your data, edit your data graphically and numerically and compare different tests.
    3. ANALYSIS: DIAdem has a wide range of analysis functions, ranging from simple functions like integration and differentiation to FFTs, Order analysis and 3D data analysis.
    4. REPORT: The DIAdem REPORT tool allows you to create reusable report layouts that can contain multiple axis systems (2D, 3D and polar plots) as well as tables (2D and 3D) and variables. The REPORT tool generates templates that can be usedwith multiple data sets due to the inclusion of automatic (or manula if required) scaling as well as extensive use of variables for annotations. Finished reports can be exported to printers, graphics files, the Windows Clipboard, HTML pages and PDF files (PDF writing is build into DIAdem, no extra software required). Using Scripts, it is also possible to create Word, Excel or Powerpoint reports from DIAdem automatically.
    5. SCRIPT: The DIAdem scripting tools allows users to record macros or write scripts that automate complete sequences, for the import of data, via extensive analysis, to creating a publication ready report. Scripts can make reports "intelligent" by modifying the appearance of a report based on the data or calculation results that are going to be displayed in the report.
    I recommend you check out the following link for more information: http://www.ni.com/diadem/
    DIAdem is an extremly powerful tool for report generation. I am leaving to go on a business trip to Asia, but I would be more than happy to give you an Web presentation on DIAdem after I have returned. We could use your data and create a DIAdem report Script together online. My Email address is [email protected] and I will be back the week of Thanksgiving.
          Otmar
    Otmar D. Foehner
    Business Development Manager
    DIAdem and Test Data Management
    National Instruments
    Austin, TX - USA
    "For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary."

  • PL/SQL 101 : Cursors and SQL Projection

    PL/SQL 101 : Cursors and SQL Projection
    This is not a question, it's a forum article, in reponse to the number of questions we get regarding a "dynamic number of columns" or "rows to columns"
    There are two integral parts to an SQL Select statement that relate to what data is selected. One is Projection and the other is Selection:-
    Selection is the one that we always recognise and use as it forms the WHERE clause of the select statement, and hence selects which rows of data are queried.
    The other, SQL Projection is the one that is less understood, and the one that this article will help to explain.
    In short, SQL Projection is the collective name for the columns that are Selected and returned from a query.
    So what? Big deal eh? Why do we need to know this?
    The reason for knowing this is that many people are not aware of when SQL projection comes into play when you issue a select statement. So let's take a basic query...
    First create some test data...
    create table proj_test as
      select 1 as id, 1 as rn, 'Fred' as nm from dual union all
      select 1,2,'Bloggs' from dual union all
      select 2,1,'Scott' from dual union all
      select 2,2,'Smith' from dual union all
      select 3,1,'Jim' from dual union all
      select 3,2,'Jones' from dual
    ... and now query that data...
    SQL> select * from proj_test;
             ID         RN NM
             1          1 Fred
             1          2 Bloggs
             2          1 Scott
             2          2 Smith
             3          1 Jim
             3          2 Jones
    6 rows selected.
    OK, so what is that query actually doing?
    To know that we need to consider that all queries are cursors and all cursors are processed in a set manner, roughly speaking...
    1. The cursor is opened
    2. The query is parsed
    3. The query is described to know the projection (what columns are going to be returned, names, datatypes etc.)
    4. Bind variables are bound in
    5. The query is executed to apply the selection and identify the data to be retrieved
    6. A row of data is fetched
    7. The data values from the columns within that row are extracted into the known projection
    8. Step 6 and 7 are repeated until there is no more data or another condition ceases the fetching
    9. The cursor is closed
    The purpose of the projection being determined is so that the internal processing of the cursor can allocate memory etc. ready to fetch the data into. We won't get to see that memory allocation happening easily, but we can see the same query being executed in these steps if we do it programatically using the dbms_sql package...
    CREATE OR REPLACE PROCEDURE process_cursor (p_query in varchar2) IS
      v_sql       varchar2(32767) := p_query;
      v_cursor    number;            -- A cursor is a handle (numeric identifier) to the query
      col_cnt     integer;
      v_n_val     number;            -- numeric type to fetch data into
      v_v_val     varchar2(20);      -- varchar type to fetch data into
      v_d_val     date;              -- date type to fetch data into
      rec_tab     dbms_sql.desc_tab; -- table structure to hold sql projection info
      dummy       number;
      v_ret       number;            -- number of rows returned
      v_finaltxt  varchar2(100);
      col_num     number;
    BEGIN
      -- 1. Open the cursor
      dbms_output.put_line('1 - Opening Cursor');
      v_cursor := dbms_sql.open_cursor;
      -- 2. Parse the cursor
      dbms_output.put_line('2 - Parsing the query');
      dbms_sql.parse(v_cursor, v_sql, dbms_sql.NATIVE);
      -- 3. Describe the query
      -- Note: The query has been described internally when it was parsed, but we can look at
      --       that description...
      -- Fetch the description into a structure we can read, returning the count of columns that has been projected
      dbms_output.put_line('3 - Describing the query');
      dbms_sql.describe_columns(v_cursor, col_cnt, rec_tab);
      -- Use that description to define local datatypes into which we want to fetch our values
      -- Note: This only defines the types, it doesn't fetch any data and whilst we can also
      --       determine the size of the columns we'll just use some fixed sizes for this example
      dbms_output.put_line(chr(10)||'3a - SQL Projection:-');
      for j in 1..col_cnt
      loop
        v_finaltxt := 'Column Name: '||rpad(upper(rec_tab(j).col_name),30,' ');
        case rec_tab(j).col_type
          -- if the type of column is varchar2, bind that to our varchar2 variable
          when 1 then
            dbms_sql.define_column(v_cursor,j,v_v_val,20);
            v_finaltxt := v_finaltxt||' Datatype: Varchar2';
          -- if the type of the column is number, bind that to our number variable
          when 2 then
            dbms_sql.define_column(v_cursor,j,v_n_val);
            v_finaltxt := v_finaltxt||' Datatype: Number';
          -- if the type of the column is date, bind that to our date variable
          when 12 then
            dbms_sql.define_column(v_cursor,j,v_d_val);
            v_finaltxt := v_finaltxt||' Datatype: Date';
          -- ...Other types can be added as necessary...
        else
          -- All other types we'll assume are varchar2 compatible (implicitly converted)
          dbms_sql.DEFINE_COLUMN(v_cursor,j,v_v_val,2000);
          v_finaltxt := v_finaltxt||' Datatype: Varchar2 (implicit)';
        end case;
        dbms_output.put_line(v_finaltxt);
      end loop;
      -- 4. Bind variables
      dbms_output.put_line(chr(10)||'4 - Binding in values');
      null; -- we have no values to bind in for our test
      -- 5. Execute the query to make it identify the data on the database (Selection)
      -- Note: This doesn't fetch any data, it just identifies what data is required.
      dbms_output.put_line('5 - Executing the query');
      dummy := dbms_sql.execute(v_cursor);
      -- 6.,7.,8. Fetch the rows of data...
      dbms_output.put_line(chr(10)||'6,7 and 8 Fetching Data:-');
      loop
        -- 6. Fetch next row of data
        v_ret := dbms_sql.fetch_rows(v_cursor);
        -- If the fetch returned no row then exit the loop
        exit when v_ret = 0;
        -- 7. Extract the values from the row
        v_finaltxt := null;
        -- loop through each of the Projected columns
        for j in 1..col_cnt
        loop
          case rec_tab(j).col_type
            -- if it's a varchar2 column
            when 1 then
              -- read the value into our varchar2 variable
              dbms_sql.column_value(v_cursor,j,v_v_val);
              v_finaltxt := ltrim(v_finaltxt||','||rpad(v_v_val,20,' '),',');
            -- if it's a number column
            when 2 then
              -- read the value into our number variable
              dbms_sql.column_value(v_cursor,j,v_n_val);
              v_finaltxt := ltrim(v_finaltxt||','||to_char(v_n_val,'fm999999'),',');
            -- if it's a date column
            when 12 then
              -- read the value into our date variable
              dbms_sql.column_value(v_cursor,j,v_d_val);
              v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          else
            -- read the value into our varchar2 variable (assumes it can be implicitly converted)
            dbms_sql.column_value(v_cursor,j,v_v_val);
            v_finaltxt := ltrim(v_finaltxt||',"'||rpad(v_v_val,20,' ')||'"',',');
          end case;
        end loop;
        dbms_output.put_line(v_finaltxt);
        -- 8. Loop to fetch next row
      end loop;
      -- 9. Close the cursor
      dbms_output.put_line(chr(10)||'9 - Closing the cursor');
      dbms_sql.close_cursor(v_cursor);
    END;
    SQL> exec process_cursor('select * from proj_test');
    1 - Opening Cursor
    2 - Parsing the query
    3 - Describing the query
    3a - SQL Projection:-
    Column Name: ID                             Datatype: Number
    Column Name: RN                             Datatype: Number
    Column Name: NM                             Datatype: Varchar2
    4 - Binding in values
    5 - Executing the query
    6,7 and 8 Fetching Data:-
    1     ,1     ,Fred
    1     ,2     ,Bloggs
    2     ,1     ,Scott
    2     ,2     ,Smith
    3     ,1     ,Jim
    3     ,2     ,Jones
    1     ,3     ,Freddy
    1     ,4     ,Fud
    9 - Closing the cursor
    PL/SQL procedure successfully completed.
    So, what's really the point in knowing when SQL Projection occurs in a query?
    Well, we get many questions asking "How do I convert rows to columns?" (otherwise known as a pivot) or questions like "How can I get the data back from a dynamic query with different columns?"
    Let's look at a regular pivot. We would normally do something like...
    SQL> select id
      2        ,max(decode(rn,1,nm)) as nm_1
      3        ,max(decode(rn,2,nm)) as nm_2
      4  from proj_test
      5  group by id
      6  /
            ID NM_1   NM_2
             1 Fred   Bloggs
             2 Scott  Smith
             3 Jim    Jones
    (or, in 11g, use the new PIVOT statement)
    but many of these questioners don't understand it when they say their issue is that, they have an unknown number of rows and don't know how many columns it will have, and they are told that you can't do that in a single SQL statement. e.g.
    SQL> insert into proj_test (id, rn, nm) values (1,3,'Freddy');
    1 row created.
    SQL> select id
      2        ,max(decode(rn,1,nm)) as nm_1
      3        ,max(decode(rn,2,nm)) as nm_2
      4  from proj_test
      5  group by id
      6  /
            ID NM_1   NM_2
             1 Fred   Bloggs
             2 Scott  Smith
             3 Jim    Jones
    ... it's not giving us this 3rd entry as a new column and we can only get that by writing the expected columns into the query, but then what if more columns are added after that etc.
    If we look back at the steps of a cursor we see again that the description and projection of what columns are returned by a query happens before any data is fetched back.
    Because of this, it's not possible to have the query return back a number of columns that are based on the data itself, as no data has been fetched at the point the projection is required.
    So, what is the answer to getting an unknown number of columns in the output?
    1) The most obvious answer is, don't use SQL to try and pivot your data. Pivoting of data is more of a reporting requirement and most reporting tools include the ability to pivot data either as part of the initial report generation or on-the-fly at the users request. The main point about using the reporting tools is that they query the data first and then the pivoting is simply a case of manipulating the display of those results, which can be dynamically determined by the reporting tool based on what data there is.
    2) The other answer is to write dynamic SQL. Because you're not going to know the number of columns, this isn't just a simple case of building up a SQL query as a string and passing it to the EXECUTE IMMEDIATE command within PL/SQL, because you won't have a suitable structure to read the results back into as those structures must have a known number of variables for each of the columns at design time, before the data is know. As such, inside PL/SQL code, you would have to use the DBMS_SQL package, just like in the code above that showed the workings of a cursor, as the columns there are referenced by position rather than name, and you have to deal with each column seperately. What you do with each column is up to you... store them in an array/collection, process them as you get them, or whatever. They key thing though with doing this is that, just like the reporting tools, you would need to process the data first to determine what your SQL projection is, before you execute the query to fetch the data in the format you want e.g.
    create or replace procedure dyn_pivot is
      v_sql varchar2(32767);
      -- cursor to find out the maximum number of projected columns required
      -- by looking at the data
      cursor cur_proj_test is
        select distinct rn
        from   proj_test
        order by rn;
    begin
      v_sql := 'select id';
      for i in cur_proj_test
      loop
        -- dynamically add to the projection for the query
        v_sql := v_sql||',max(decode(rn,'||i.rn||',nm)) as nm_'||i.rn;
      end loop;
      v_sql := v_sql||' from proj_test group by id order by id';
      dbms_output.put_line('Dynamic SQL Statement:-'||chr(10)||v_sql||chr(10)||chr(10));
      -- call our DBMS_SQL procedure to process the query with it's dynamic projection
      process_cursor(v_sql);
    end;
    SQL> exec dyn_pivot;
    Dynamic SQL Statement:-
    select id,max(decode(rn,1,nm)) as nm_1,max(decode(rn,2,nm)) as nm_2,max(decode(rn,3,nm)) as nm_3 from proj_test group by id order by id
    1 - Opening Cursor
    2 - Parsing the query
    3 - Describing the query
    3a - SQL Projection:-
    Column Name: ID                             Datatype: Number
    Column Name: NM_1                           Datatype: Varchar2
    Column Name: NM_2                           Datatype: Varchar2
    Column Name: NM_3                           Datatype: Varchar2
    4 - Binding in values
    5 - Executing the query
    6,7 and 8 Fetching Data:-
    1     ,Fred                ,Bloggs              ,Freddy
    2     ,Scott               ,Smith               ,
    3     ,Jim                 ,Jones               ,
    9 - Closing the cursor
    PL/SQL procedure successfully completed.
    ... and if more data is added ...
    SQL> insert into proj_test (id, rn, nm) values (1,4,'Fud');
    1 row created.
    SQL> exec dyn_pivot;
    Dynamic SQL Statement:-
    select id,max(decode(rn,1,nm)) as nm_1,max(decode(rn,2,nm)) as nm_2,max(decode(rn,3,nm)) as nm_3,max(decode(rn,4,nm)) as nm_4 from proj_test group by id order by id
    1 - Opening Cursor
    2 - Parsing the query
    3 - Describing the query
    3a - SQL Projection:-
    Column Name: ID                             Datatype: Number
    Column Name: NM_1                           Datatype: Varchar2
    Column Name: NM_2                           Datatype: Varchar2
    Column Name: NM_3                           Datatype: Varchar2
    Column Name: NM_4                           Datatype: Varchar2
    4 - Binding in values
    5 - Executing the query
    6,7 and 8 Fetching Data:-
    1     ,Fred                ,Bloggs              ,Freddy              ,Fud
    2     ,Scott               ,Smith               ,                    ,
    3     ,Jim                 ,Jones               ,                    ,
    9 - Closing the cursor
    PL/SQL procedure successfully completed.
    Of course there are other methods, using dynamically generated scripts etc. (see Re: 4. How do I convert rows to columns?), but the above simply demonstrates that:-
    a) having a dynamic projection requires two passes of the data; one to dynamically generate the query and another to actually query the data,
    b) it is not a good idea in most cases as it requires code to handle the results dynamically rather than being able to simply query directly into a known structure or variables, and
    c) a simple SQL statement cannot have a dynamic projection.
    Most importantly, dynamic queries prevent validation of your queries at the time your code is compiled, so the compiler can't check that the column names are correct or the tables names, or that the actual syntax of the generated query is correct. This only happens at run-time, and depending upon the complexity of your dynamic query, some problems may only be experienced under certain conditions. In effect you are writing queries that are harder to validate and could potentially have bugs in them that would are not apparent until they get to a run time environment. Dynamic queries can also introduce the possibility of SQL injection (a potential security risk), especially if a user is supplying a string value into the query from an interface.
    To summarise:-
    The projection of an SQL statement must be known by the SQL engine before any data is fetched, so don't expect SQL to magically create columns on-the-fly based on the data it's retrieving back; and, if you find yourself thinking of using dynamic SQL to get around it, just take a step back and see if what you are trying to achieve may be better done elsewhere, such as in a reporting tool or the user interface.
    Other articles in the PL/SQL 101 series:-
    PL/SQL 101 : Understanding Ref Cursors
    PL/SQL 101 : Exception Handling

    excellent article. However there is one thing which is slightly erroneous. You don't need a type to be declared in the database to fetch the data, but you do need to declare a type;
    here is one of my unit test scripts that does just that.
    DECLARE
    PN_CARDAPPL_ID NUMBER;
    v_Return Cci_Standard.ref_cursor;
    type getcardapplattrval_recordtype
    Is record
    (cardappl_id ci_cardapplattrvalue.cardappl_ID%TYPE,
    tag ci_cardapplattrvalue.tag%TYPE,
    value ci_cardapplattrvalue.value%TYPE
    getcardapplattrvalue_record getcardapplattrval_recordtype;
    BEGIN
    PN_CARDAPPL_ID := 1; --value must be supplied
    v_Return := CCI_GETCUSTCARD.GETCARDAPPLATTRVALUE(
    PN_CARDAPPL_ID => PN_CARDAPPL_ID
    loop
    fetch v_return
    into getcardapplattrvalue_record;
    dbms_output.put_line('Cardappl_id=>'||getcardapplattrvalue_record.cardappl_id);
    dbms_output.put_line('Tag =>'||getcardapplattrvalue_record.tag);
    dbms_output.put_line('Value =>'||getcardapplattrvalue_record.value);
    exit when v_Return%NOTFOUND;
    end loop;
    END;

  • Oracle 9 and Crystal Report

    I want to run a crystal report against an oracle database procedure. I know that I will have to user REF CURSOR for that purpose. If I try to update a table within that procedure and use REF CURSOR and call the procedure from Crystal report it gives an error that you cannot update in this procedure. I just wonder if that is possible some how.
    Basically I want to update a table after I run a Crystal Report but I can only call the crystal report from my application and do not want to run the update procedure seperately.
    Thanks,

    If the procedures work from SQL*Plus, then there can't be anything wrong with your databases. Also, Crystal should be able to run any procedure that will run from SQL*Plus, so that leaves the ODBC drivers to look at.
    Look at the settings for the ODBC DSN. Is the stored procedure in the logged in user's schema, or in a different schema? The CR ODBC drivers default to looking only in the logged in user's schema. To use a stored procedure in someone else's schema, you must uncheck the "Use Current Schema for SQL Procedures" box.
    If this is the case, be aware that when designing a new Crystal Report with that option unchecked, you may have to wait a very long time for the Database Expert to populate and display. Is there some reason that you can't use Crystal's native driver for Oracle. It does not have this problem.

  • Oracle 9i and Crystal report 9

    Can somebody help me in this.
    Both the database using the same version of oracle (That is 9.2. Created package for referential cursor,Created global temporary table and created SP using the ref cursor and global temporary table in both database.
    Using ODBC,created the report in CRYSTAL report 9 using same sp was possible in one database while in other it is not. and giving the follwing eeror,
    Error text:'HY000: [Data direct] [ODBC Oracle Driver] [Oracle] ORA-06550:
    Line 1,Column 14
    PLS-00302: Componenet SP_RPT_CANN_PKG_RPTC32 must be declared
    ORA-06550:line 1 Column 8
    PL/SQL: Statement ignored
    What could be the possible diffrences in two database.

    If the procedures work from SQL*Plus, then there can't be anything wrong with your databases. Also, Crystal should be able to run any procedure that will run from SQL*Plus, so that leaves the ODBC drivers to look at.
    Look at the settings for the ODBC DSN. Is the stored procedure in the logged in user's schema, or in a different schema? The CR ODBC drivers default to looking only in the logged in user's schema. To use a stored procedure in someone else's schema, you must uncheck the "Use Current Schema for SQL Procedures" box.
    If this is the case, be aware that when designing a new Crystal Report with that option unchecked, you may have to wait a very long time for the Database Expert to populate and display. Is there some reason that you can't use Crystal's native driver for Oracle. It does not have this problem.

  • Problems with cursor and shortcuts when using JNLP services on MAC OS X

    After invoking the JNLP services on a MAC I loose the ability to set the cursor and invoke keyboard shortcuts. On Windows this is not a problem, so I believe it is a bug and I have reported it to Apple. Meanwhile, I would appreciate if someone could help me with finding a work-around. To identify the problem run the following code with Java Web Start (i.e., you need to add the program to a jar and launch it using a JNLP script). You also need to include the javax.jnlp package.
    Observe that the cursor changes to cross-hairs when entering the circle. After invoking the Open file menu item, the cursor does not change any longer. Shortcut key do not work either, but if you open the menu and close it again without selecting any of the menu items, the shortcuts are OK again.
    package bugreport;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.IOException;
    import javax.swing.*;
    import javax.jnlp.*;
    public class Demo2 extends JPanel implements Runnable, MouseMotionListener {
        private int centerX = 100;
        private int centerY = 100;
        private int radius = 50;
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Demo2());
        public void run() {
            int menuMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
            final JFrame frame = new JFrame("Bug Demo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setPreferredSize(new Dimension(200, 200));
            addMouseMotionListener(this);
            JMenuBar menuBar = new JMenuBar();
            frame.setJMenuBar(menuBar);
            //File menu
            JMenu fileMenu = new JMenu("File");
            fileMenu.setMnemonic('F');
            menuBar.add(fileMenu);
            //openMenuItem
            JMenuItem openMenuItem = new JMenuItem("Open...");
            openMenuItem.setMnemonic('O');
            openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, menuMask));
            openMenuItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    openFile();
            fileMenu.add(openMenuItem);
            frame.add(this);
            frame.pack();
            frame.setResizable(false);
            frame.setVisible(true);
        @Override
        public void paintComponent(Graphics g) {
            g.clearRect(0, 0, getWidth(), getHeight());
            g.setColor(Color.BLUE);
            g.fillOval(centerX - radius, centerY - radius, 2 * radius, 2 * radius);
        public void mouseDragged(MouseEvent e) {
        public void mouseMoved(MouseEvent e) {
            int dx = e.getX() - centerX;
            int dy = e.getY() - centerY;
            if (dx * dx + dy * dy < radius * radius) {
                setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
            } else {
                setCursor(Cursor.getDefaultCursor());
        private void openFile() {
            FileOpenService fos = null;
            try {
                fos = (FileOpenService) ServiceManager.lookup("javax.jnlp.FileOpenService");
            } catch (UnavailableServiceException ex) {
                JOptionPane.showMessageDialog(this, "Service unavailable", "Open", JOptionPane.ERROR_MESSAGE);
            if (fos != null) {
                try {
                    FileContents fc = fos.openFileDialog(null, null);
                } catch (IOException ex) {
                    JOptionPane.showMessageDialog(this, "Service unavailable", "Open", JOptionPane.ERROR_MESSAGE);
    }Edited by: James_Vagabond on Oct 29, 2009 9:35 AM

    Barbara, Thanks very much taking the time to respond to my posting. Your input and directions were just what I needed.I accessed the print settings in the pull down menu, setup the print options including the color profile for Elements and the Printer to sRGB, and printed my picture. This resolved all the invalid color problems I was having, but I did notice that there was a hint of magenta overall in the picture. I had read an article that said to use Canon Color Matching instead of Color Sync to prevent that but I couldn't make that change in the pull down menu. I tried in the Presets dialog box but that didn't appear to be possible. Should I make that change as well?
    Also, in my travels through Elements 13 I notice under Edit->Color Settings that there were options for No Color Mgmt, Optimize for Screen, for Printing, or ability to chose one or the other (real time I assume). How do those options fit into this scenario?
    Thanks again

  • Multiple paged report

    Hi, I am somehow new to SAP CR for VS2010 and I am trying to create a report that is divided in 3 pages with data in each page related to the previous page. How can i create a multiple paged report? What i want to do is something like this.
    ======will be printed in page 1==========            =======will be printed in page 2====             ===========will be printed in page 3=====
    Rec no. Employee name EmpID Gross income   |      Basic Salary    Bonus  Compensation     |          Exemption code      Tax withheld      Tax due
    1            Peter parker      0001      $5,0000         |         $450               $200        $2.50           |                M1                           $50              $60
    2            Emma stone   0002      $15,000           |         $500                $350       $10              |                S3                            $80              $55
    this is just a sample data/field needed in each page. I tried using section expert and inserted another section under details but it does not give me what i want. TIA.

    Yes, but this is going to be a bit tricky.
    1.  Create a formula called "InitPage":
         NumberVar page = 1;
         Place this formula in the report header - it won't display because of the final ";"
    2.  Create another formula called "SetPage":
         NumberVar page;
         if page = 3 then page := 1
         else page := page + 1;
         Place this formula in the page footer.
    3.  Create a formula called "InitRows": (NOTE:  This assumes that your data for each row is using a numeric ID as the key)
         Global NumberVar Array rowInfo := [-1];
         1;  //formulas cannot return an array, so we give it a meaningless value to return
         Place this formula in the report header.
    4.  Create a formula called "ClearRows":
         EvaluateAfter({@SetPage});
         Global NumberVar Array rowInfo;
         NumberVar page;
         if page = 1 then
              Redim rowInfo[1];
              rowInfo[1] := -1;
         1;
         Place this in the page footer below the {@SetPage} formula.
    5.  Create a formula called "SetRow":
         Global NumberVar Array rowInfo;
         NumberVar page;
         if page = 1 then
              if not ({MyTable.ID} in rowInfo) then
                  if rowInfo[1] = -1 then
                        rowInfo[1] := {MyTable.ID}
                  else
                       //Add one element to the array.
                       Redim Preserve rowInfo[UBound(rowInfo) + 1];
                       //Set the element to the value you need for linking the data.
                       rowInfo[UBound(rowInfo)] := {MyTable.ID}
         1;
         Place this formula in your details section - it won't show anything, but it will set up the array for use in the subreports.
    6.  Keep your subreports in the details sections as they are.
    7.  In the Section Expert, do the following:
         a.  Turn off "New Page After" on the first details section.
         b.  For the second details section, set the Suppress formula to:
                   NumberVar page;
                   page <> 2
         c.  For the third details section, set the Suppress formula to:
                   NumberVar page;
                   page < 3
    7.  In your subreport, create a Formula called "FilterArray":
         Global NumberVar Array rowInfo
         Note that there is NO semi-colon on the end of this!
    8.  In the Select Expert, edit the selection formula to add something like this:
         {MyTable.ID} in {@FilterArray}
    I haven't tested any of this other than to make sure that Crystal will verify the formulas.  But, it should get you close to what you're looking for.
    -Dell

  • Bug and Fix: Report Template Preview displays ORA-01002

    Hi, omniscient All!
    Let me share some knowledge with you. There is an old APEX bug:
    BUG: preview report template errors with ORA-01002
    Report Template Preview/Copy Error
    Template Preview Error:
    You can definitely see it in 4.0, 4.1, 4.2, 4.2.1 versions: open any database application in AppBuilder, go to Shared Components→Templates, move cursor on Some Report Template row, click Preview Icon. Voilà:
    report error:
    ORA-01002: fetch out of sequenceI looked into Template Preview region's source and have found next WWV_RENDER_REPORT3.show call:
    wwv_render_report3.show(
        p_query => '
    select 1 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 2 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 3 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 4 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 5 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 6 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual
    order by 1',
        p_row_template_id => :f4000_p245_id,
        p_region_id => 88449328191587806
      );I have no wish to go deep into my further investigation, therefore I just call a cause: APEX Team, you forgot to set the value of P_PLUG_SOURCE_TYPE parameter.
    Workaround: While APEX Team will making a patch, those who can't wait it should fix it manually by executing next code:
    update &APEX_SCHEMA.wwv_flow_page_plugs
       set plug_source = q'{wwv_render_report3.show(
        p_query => '
    select 1 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 2 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 3 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 4 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 5 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual union
    select 6 COL1, ''[...]'' COL2, ''[...]'' COL3, sysdate COL4 from dual
    order by 1',
        p_row_template_id => :f4000_p245_id,
        p_region_id => 88449328191587806,
        p_plug_source_type => 'SQL_QUERY'
    where id = 14562627207747006
    /APEX_SCHEMA is schema where APEX was installed.
    Good luck,
    Alex
    Edited by: tiPPLer on 14.02.2013 17:14

    I wouldn't mind piggy-backing this to ask if the Report Template "shortcut" links at the top of the page can be updated to account for all sections that are now a part of the Report Template. "Before Each Row" and "After Each Row" sections are not listed in the shortcuts. There are also two shortcuts listed as "Before" and "After" which should probably be relabeled.
    Shane.

  • Help with if statement in cursor and for loop to get output

    I have the following cursor and and want to use if else statement to get the output. The cursor is working fine. What i need help with is how to use and if else statement to only get the folderrsn that have not been updated in the last 30 days. If you look at the talbe below my select statement is showing folderrs 291631 was updated only 4 days ago and folderrsn 322160 was also updated 4 days ago.
    I do not want these two to appear in my result set. So i need to use if else so that my result only shows all folderrsn that havenot been updated in the last 30 days.
    Here is my cursor:
    /*Cursor for Email procedure. It is working Shows userid and the string
    You need to update these folders*/
    DECLARE
    a_user varchar2(200) := null;
    v_assigneduser varchar2(20);
    v_folderrsn varchar2(200);
    v_emailaddress varchar2(60);
    v_subject varchar2(200);
    Cursor c IS
    SELECT assigneduser, vu.emailaddress, f.folderrsn, trunc(f.indate) AS "IN DATE",
    MAX (trunc(fpa.attemptdate)) AS "LAST UPDATE",
    trunc(sysdate) - MAX (trunc(fpa.attemptdate)) AS "DAYS PAST"
    --MAX (TRUNC (fpa.attemptdate)) - TRUNC (f.indate) AS "NUMBER OF DAYS"
    FROM folder f, folderprocess fp, validuser vu, folderprocessattempt fpa
    WHERE f.foldertype = 'HJ'
    AND f.statuscode NOT IN (20, 40)
    AND f.folderrsn = fp.folderrsn
    AND fp.processrsn = fpa.processrsn
    AND vu.userid = fp.assigneduser
    AND vu.statuscode = 1
    GROUP BY assigneduser, vu.emailaddress, f.folderrsn, f.indate
    ORDER BY fp.assigneduser;
    BEGIN
    FOR c1 IN c LOOP
    IF (c1.assigneduser = v_assigneduser) THEN
    dbms_output.put_line(' ' || c1.folderrsn);
    else
    dbms_output.put(c1.assigneduser ||': ' || 'Overdue Folders:You need to update these folders: Folderrsn: '||c1.folderrsn);
    END IF;
    a_user := c1.assigneduser;
    v_assigneduser := c1.assigneduser;
    v_folderrsn := c1.folderrsn;
    v_emailaddress := c1.emailaddress;
    v_subject := 'Subject: Project for';
    END LOOP;
    END;
    The reason I have included the folowing table is that I want you to see the output from the select statement. that way you can help me do the if statement in the above cursor so that the result will look like this:
    emailaddress
    Subject: 'Project for ' || V_email || 'not updated in the last 30 days'
    v_folderrsn
    v_folderrsn
    etc
    [email protected]......
    Subject: 'Project for: ' Jim...'not updated in the last 30 days'
    284087
    292709
    [email protected].....
    Subject: 'Project for: ' Kim...'not updated in the last 30 days'
    185083
    190121
    190132
    190133
    190159
    190237
    284109
    286647
    294631
    322922
    [email protected]....
    Subject: 'Project for: Joe...'not updated in the last 30 days'
    183332
    183336
    [email protected]......
    Subject: 'Project for: Sam...'not updated in the last 30 days'
    183876
    183877
    183879
    183880
    183881
    183882
    183883
    183884
    183886
    183887
    183888
    This table is to shwo you the select statement output. I want to eliminnate the two days that that are less than 30 days since the last update in the last column.
    Assigneduser....Email.........Folderrsn...........indate.............maxattemptdate...days past since last update
    JIM.........      jim@ aol.com.... 284087.............     9/28/2006.......10/5/2006...........690
    JIM.........      jim@ aol.com.... 292709.............     3/20/2007.......3/28/2007............516
    KIM.........      kim@ aol.com.... 185083.............     8/31/2004.......2/9/2006.............     928
    KIM...........kim@ aol.com.... 190121.............     2/9/2006.........2/9/2006.............928
    KIM...........kim@ aol.com.... 190132.............     2/9/2006.........2/9/2006.............928
    KIM...........kim@ aol.com.... 190133.............     2/9/2006.........2/9/2006.............928
    KIM...........kim@ aol.com.... 190159.............     2/13/2006.......2/14/2006............923
    KIM...........kim@ aol.com.... 190237.............     2/23/2006.......2/23/2006............914
    KIM...........kim@ aol.com.... 284109.............     9/28/2006.......9/28/2006............697
    KIM...........kim@ aol.com.... 286647.............     11/7/2006.......12/5/2006............629
    KIM...........kim@ aol.com.... 294631.............     4/2/2007.........3/4/2008.............174
    KIM...........kim@ aol.com.... 322922.............     7/29/2008.......7/29/2008............27
    JOE...........joe@ aol.com.... 183332.............     1/28/2004.......4/23/2004............1585
    JOE...........joe@ aol.com.... 183336.............     1/28/2004.......3/9/2004.............1630
    SAM...........sam@ aol.com....183876.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183877.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183879.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183880.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183881.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183882.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183883.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183884.............3/5/2004.........3/8/2004............     1631
    SAM...........sam@ aol.com....183886.............3/5/2004.........3/8/2004............     1631
    SAM...........sam@ aol.com....183887.............3/5/2004.........3/8/2004............     1631
    SAM...........sam@ aol.com....183888.............3/5/2004.........3/8/2004............     1631
    PAT...........pat@ aol.com.....291630.............2/23/2007.......7/8/2008............     48
    PAT...........pat@ aol.com.....313990.............2/27/2008.......7/28/2008............28
    NED...........ned@ aol.com.....190681.............4/4/2006........8/10/2006............746
    NED...........ned@ aol.com......95467.............6/14/2006.......11/6/2006............658
    NED...........ned@ aol.com......286688.............11/8/2006.......10/3/2007............327
    NED...........ned@ aol.com.....291631.............2/23/2007.......8/21/2008............4
    NED...........ned@ aol.com.....292111.............3/7/2007.........2/26/2008............181
    NED...........ned@ aol.com.....292410.............3/15/2007.......7/22/2008............34
    NED...........ned@ aol.com.....299410.............6/27/2007.......2/27/2008............180
    NED...........ned@ aol.com.....303790.............9/19/2007.......9/19/2007............341
    NED...........ned@ aol.com.....304268.............9/24/2007.......3/3/2008............     175
    NED...........ned@ aol.com.....308228.............12/6/2007.......12/6/2007............263
    NED...........ned@ aol.com.....316689.............3/19/2008.......3/19/2008............159
    NED...........ned@ aol.com.....316789.............3/20/2008.......3/20/2008............158
    NED...........ned@ aol.com.....317528.............3/25/2008.......3/25/2008............153
    NED...........ned@ aol.com.....321476.............6/4/2008.........6/17/2008............69
    NED...........ned@ aol.com.....322160.............7/3/2008.........8/21/2008............4
    MOE...........moe@ aol.com.....184169.............4/5/2004.......12/5/2006............629
    [email protected]/27/2004.......3/8/2004............1631
    How do I incorporate a if else statement in the above cursor so the two days less than 30 days since last update are not returned. I do not want to send email if the project have been updated within the last 30 days.
    Edited by: user4653174 on Aug 25, 2008 2:40 PM

    analytical functions: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm#81409
    CASE
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/02_funds.htm#36899
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/04_struc.htm#5997
    Incorporating either of these into your query should assist you in returning the desired results.

  • Sorting in 6i and 10g reports

    Hello All,
    I am running 6i and 10g reports against a 10g database.
    I ran one of the 6i report and it generated a report in one sorting ordear
    and when i ran the same report on 10g ,it generated the report in ddifferent order.
    Both the reports r run against the same 10g database.
    The order by clause on the columns of the records r identical.
    Now i wanted to understand how it is sorting in different orders in both 6i and 10g reports?
    Thanks,
    Ranz

    Hi,
    Please note the fact that 6i Reports is not certified to work with 10g Database. Hence it becomes impossible to address the sorting behavior of 6i Reports, though there is nothing different in the way it works. I would suggest you to use 10gR2 version of Reports services with 10g Database which is certified and supported. Thanks for your understanding.
    Regards,
    Anand

  • Crystal report(Can i link sub report and main report Compulsorily) - invalid path

    hi.
    i need small clarification.
    i am developing one Crystal report
    main report i took it from rdr1 one table...
    report is working fine..
    Sub report i took it from inv1 one table.
    i have not linked any fields from these tables.
    May be it is having links in b1..
    but in my other report both the tables.... from main report  and sub report does not have any relation.
    My Questions is..
    Can i Compulsorily link fields to main report...
    if both does not have any relation what should i do...
    i took two tables.
    main report rdr1
    sub report inv1...
    if i  run the report it is asking two parameters one is for sub report and other one for main report working find in crystal report.
    but...i want to run the report in b1.
    while importing i am getting the error (Plz have a look on below image)
    if i choose any other report it is importing  fine...
    Clearly i am mentioning i dont want to link both tables there is no links between two reports...
    in this scenario can develop  a report..
    I need your Valuable suggestions.
    here below u can find my developed sample report...
    http://www.megafileupload.com/en/file/544758/NewReport-rpt.html

    hi.
    If i try only i am getting the error..
    out side if i run i am able to run the crystal report but
    in b1 i am not able to import the report.
    you can also try my report
    from below link u can get my simple report.
    if u find any mistake what i have done plz inform me..
    http://megafileupload.com/en/file/544806/NewReport85-rpt.html

Maybe you are looking for