Nee help in PL/SQL or SQL

We need to know that how many SID are getting created and deleted,existing for each time stamp : -
You can assume that for the first timestamp entry, all SID are new.
for example : -
TIMESTAMP SID
11/12/2008 1:25:02 PM 10
11/12/2008 1:25:02 PM 20 Total SID Count = 3
11/12/2008 1:25:02 PM 30
11/12/2008 1:30:02 PM 10 Total SID Count = 2
11/12/2008 1:30:02 PM 40
11/12/2008 1:35:00 PM 40
11/12/2008 1:35:00 PM 50 Total SID Count = 4
11/12/2008 1:35:00 PM 60
11/12/2008 1:35:00 PM 70
from above we can conclude that
I want this output
TIMESTAMP New SID Existing SID Deleted SID
11/12/2008 1:25:02 PM 3 (10,20 and 30 are new) 0 0
11/12/2008 1:30:02 PM 1 (40 is new) 1 (10 is existing) 2 (20 and 30 are deleted)
11/12/2008 1:35:00 PM 3 (50,60 and 70 are new) 1 (40 is existing) 1 (10 is deleted)

Hi,
It's easy to accidentally post the same thread twice.
If you do, edit one of the copies. Change the subject line to "Duplicate - Ignore" and, if the thread has already been answered, post a link to the other copy.
This query does what you requested:
WITH     g     AS
(     -- Begin sub-query g to compute grp_num (1, 2, 3, ...)
     SELECT     tmstmp
     ,     sid
     ,     DENSE_RANK () OVER (ORDER BY tmstmp)     AS grp_num
     FROM     table_x
)     -- End sub-query g to compute grp_num (1, 2, 3, ...)
,     sj     AS
(     -- Begin sub-query sj to outer-join each row to its predecessor
     SELECT     t.tmstmp
     ,     t.sid
     ,     CASE
               WHEN  p.tmstmp IS NULL     THEN 'N'
                              ELSE 'E'
          END     AS status_cd
     FROM          g     t
     LEFT OUTER JOIN     g     p     ON     t.sid          = p.sid
                         AND     t.grp_num     = p.grp_num + 1
)     -- End sub-query sj to outer-join each row to its predecessor
,     c     AS
(     -- Begin sub-query c to compute COUNTs (except deleted_sid)
     SELECT     tmstmp
     ,     COUNT (*)                         AS total_sid
     ,     COUNT (CASE WHEN status_cd = 'N' THEN 1 END)     AS new_sid
     ,     COUNT (CASE WHEN status_cd = 'E' THEN 1 END)     AS existing_sid
     FROM     sj
     GROUP BY     tmstmp
)     -- End sub-query c to compute COUNTs (except deleted_sid)
SELECT     tmstmp
,     new_sid
,     existing_sid
,     new_sid
     + LAG (total_sid, 1, 0) OVER (ORDER BY tmstmp)
     - total_sid     AS deleted_sid
FROM     c
ORDER BY     tmstmp
;You can tell if a sid is existing or new by doing a self-join, where you outer-join each row to the same sid and the previous tmstmp (timestamp is the name of a data type, so it's not a good name for a column). If a row has a match in the previous tmstmp, then it's existing. If a row doesn't have a match, then it's new. Sub-query sj, above, does this.
To determine which is the previous timestmp, you can first assign each distinct tmstmp a sequential number (1, 2, 3, ...) using the DENSE_RANK analytic function. Sub-query g, above, does this.
Getting the count of new and existing sids at each tmstmp is just a matter of doing an aggregate COUNT. Sub-query c, above, does this.
The number of deletions at any tmstmp is equal to difference between
(a) the number of new sids plus the total sid's from the previous tmstmp, and
(b) the total sids from the current tmstmp
The main query, above, does this, using the analytic LAG function.

Similar Messages

  • Please help urgent in PL/SQL or SQL

    I have table like
    TIMESTAMP SID
    11/12/2008 1:25:02 PM 10
    11/12/2008 1:25:02 PM 20
    11/12/2008 1:25:02 PM 30
    11/12/2008 1:30:02 PM 10
    11/12/2008 1:30:02 PM 40
    11/12/2008 1:35:00 PM 40
    11/12/2008 1:35:00 PM 50
    11/12/2008 1:35:00 PM 60
    11/12/2008 1:35:00 PM 70
    You can assume that for the first timestamp entry, all SID are new.
    eg:1.25.02timestamp new sid(10,20,30)
    compare that sid with next timestamp of sid
    eg:1.25.02timestamp has sid 10 and 1.30.02timestamp has sid 10 so existing sid is 10
    1.30.2timestamp don't have 20,30 compare with 1.25.02 timestamp so sid 20,30 are deleted
    1.30.2timestamp have 40 so newsid is 40
    then compare the secondtimestamp(1.30.2timestamp ) to thirdtimestamp(1:35:00)
    NOTE: LOOK THREAD :nee help in PL/SQL or SQL
    THIS QUERY GIVES LIKE:
    TIMESTAMP New SID Existing SID Deleted SID
    11/12/2008 1:25:02 PM 3 0 0
    11/12/2008 1:30:02 PM 1 1 2
    11/12/2008 1:35:00 PM 3 1 1
    BUT EXPECTED OUTPUT LIKE(I WANT LIKE)
    TIMESTAMP New SID Existing SID Deleted SID
    11/12/2008 1:25:02 PM 10,20, 30 0 0
    11/12/2008 1:30:02 PM 40 10 20, 30
    11/12/2008 1:35:00 PM 50,60, 70 40 10
    ANYBODY HELP PLEASE

    alter session set nls_date_format = 'MM/DD/YYYY HH:MI:SS PM'
    with t as (
               select '11/12/2008 1:25:02 PM' tstamp,10 sid  from dual union all
               select '11/12/2008 1:25:02 PM',20 from dual union all
               select '11/12/2008 1:25:02 PM',30 from dual union all
               select '11/12/2008 1:30:02 PM',10 from dual union all
               select '11/12/2008 1:30:02 PM',40 from dual union all
               select '11/12/2008 1:35:00 PM',40 from dual union all
               select '11/12/2008 1:35:00 PM',50 from dual union all
               select '11/12/2008 1:35:00 PM',60 from dual union all
               select '11/12/2008 1:35:00 PM',70 from dual
    select  tstamp,
            ltrim(replace(sys_connect_by_path(case new when 1 then sid else -1 end,','),',-1'),',') "New SID",
            ltrim(replace(sys_connect_by_path(case existing when 1 then sid else -1 end,','),',-1'),',')"Existing SID",
            ltrim(replace(sys_connect_by_path(case deleted when 1 then sid else -1 end,','),',-1'),',')"Deleted SID"
      from  (
             select  tstamp,
                     sid,
                     grp,
                     new,
                     existing,
                     deleted,
                     row_number() over(partition by grp order by sid nulls last) rn
               from  (
                       select  tstamp,
                               sid,
                               -- group number based on timestamp
                               dense_rank() over(order by tstamp) grp,
                               -- Check if sid is new sid (not present in previous group)
                               case when lag(tstamp) over(partition by sid order by tstamp) is null then 1 else 0 end new,
                               -- Check if sid is existing sid (present in previous group)
                               case when lag(tstamp) over(partition by sid order by tstamp) is null then 0 else 1 end existing,
                               0 deleted
                         from  t
                      union all
                       -- List of sid's not present in a group but present in a previous group
                       select  null tstamp,
                               sid,
                               grp + 1 grp,
                               0 new,
                               0 existing,
                               1 deleted
                         from  (
                                select  sid,
                                        grp,
                                        -- Check if sid is present in next group (1 - present, 0 - not present).
                                        case lead(grp) over(partition by sid order by grp)
                                          when grp + 1 then 1
                                          else 0
                                        end in_next_grp,
                                         -- last group number
                                        max(grp) over() max_grp
                                  from  (
                                         select  tstamp,
                                                 sid,
                                                 -- group number based on timestamp
                                                 dense_rank() over(order by tstamp) grp
                                           from  t
                         where in_next_grp = 0
                           and grp < max_grp
      where connect_by_isleaf = 1 -- we are only interested in a leaf row which represents complete branch
      start with rn = 1 -- start with first row in a group
      connect by rn = prior rn + 1 and grp = prior grp -- traverse through each sid in a group including deleted
      order by tstamp
    SQL> alter session set nls_date_format = 'MM/DD/YYYY HH:MI:SS PM'
      2  /
    Session altered.
    SQL> with t as (
      2             select '11/12/2008 1:25:02 PM' tstamp,10 sid  from dual union all
      3             select '11/12/2008 1:25:02 PM',20 from dual union all
      4             select '11/12/2008 1:25:02 PM',30 from dual union all
      5             select '11/12/2008 1:30:02 PM',10 from dual union all
      6             select '11/12/2008 1:30:02 PM',40 from dual union all
      7             select '11/12/2008 1:35:00 PM',40 from dual union all
      8             select '11/12/2008 1:35:00 PM',50 from dual union all
      9             select '11/12/2008 1:35:00 PM',60 from dual union all
    10             select '11/12/2008 1:35:00 PM',70 from dual
    11            )
    12  select  tstamp,
    13          ltrim(replace(sys_connect_by_path(case new when 1 then sid else -1 end,','),',-1'),',') "New SID",
    14          ltrim(replace(sys_connect_by_path(case existing when 1 then sid else -1 end,','),',-1'),',')"Existing SID",
    15          ltrim(replace(sys_connect_by_path(case deleted when 1 then sid else -1 end,','),',-1'),',')"Deleted SID"
    16    from  (
    17           select  tstamp,
    18                   sid,
    19                   grp,
    20                   new,
    21                   existing,
    22                   deleted,
    23                   row_number() over(partition by grp order by sid nulls last) rn
    24             from  (
    25                     select  tstamp,
    26                             sid,
    27                             -- group number based on timestamp
    28                             dense_rank() over(order by tstamp) grp,
    29                             -- Check if sid is new sid (not present in previous group)
    30                             case when lag(tstamp) over(partition by sid order by tstamp) is null then 1 else 0 end new,
    31                             -- Check if sid is existing sid (present in previous group)
    32                             case when lag(tstamp) over(partition by sid order by tstamp) is null then 0 else 1 end existing,
    33                             0 deleted
    34                       from  t
    35                    union all
    36                     -- List of sid's not present in a group but present in a previous group
    37                     select  null tstamp,
    38                             sid,
    39                             grp + 1 grp,
    40                             0 new,
    41                             0 existing,
    42                             1 deleted
    43                       from  (
    44                              select  sid,
    45                                      grp,
    46                                      -- Check if sid is present in next group (1 - present, 0 - not present).
    47                                      case lead(grp) over(partition by sid order by grp)
    48                                        when grp + 1 then 1
    49                                        else 0
    50                                      end in_next_grp,
    51                                       -- last group number
    52                                      max(grp) over() max_grp
    53                                from  (
    54                                       select  tstamp,
    55                                               sid,
    56                                               -- group number based on timestamp
    57                                               dense_rank() over(order by tstamp) grp
    58                                         from  t
    59                                      )
    60                             )
    61                       where in_next_grp = 0
    62                         and grp < max_grp
    63                   )
    64          )
    65    where connect_by_isleaf = 1 -- we are only interested in a leaf row which represents complete branch
    66    start with rn = 1 -- start with first row in a group
    67    connect by rn = prior rn + 1 and grp = prior grp -- traverse through each sid in a group including deleted
    68    order by tstamp
    69  /
    TSTAMP                New SID              Existing SID         Deleted SID
    11/12/2008 1:25:02 PM 10,20,30
    11/12/2008 1:30:02 PM 40                   10                   20,30
    11/12/2008 1:35:00 PM 50,60,70             40                   10
    SQL> SY.

  • How to resolve most of the Oracle SQL , PL/SQL Performance issues with help of quick Checklist/guidelines ?

    Please go thru below important checklist/guidelines to identify issue in any Perforamnce issue and resolution in no time.
    Checklist for Quick Performance  problem Resolution
    ·         get trace, code and other information for given PE case
              - Latest Code from Production env
              - Trace (sql queries, statistics, row source operations with row count, explain plan, all wait events)
              - Program parameters & their frequently used values
              - Run Frequency of the program
              - existing Run-time/response time in Production
              - Business Purpose
    ·         Identify most time consuming SQL taking more than 60 % of program time using Trace & Code analysis
    ·         Check all mandatory parameters/bind variables are directly mapped to index columns of large transaction tables without any functions
    ·         Identify most time consuming operation(s) using Row Source Operation section
    ·         Study program parameter input directly mapped to SQL
    ·         Identify all Input bind parameters being used to SQL
    ·         Is SQL query returning large records for given inputs
    ·         what are the large tables and their respective columns being used to mapped with input parameters
    ·         which operation is scanning highest number of records in Row Source operation/Explain Plan
    ·         Is Oracle Cost Based Optimizer using right Driving table for given SQL ?
    ·         Check the time consuming index on large table and measure Index Selectivity
    ·         Study Where clause for input parameters mapped to tables and their columns to find the correct/optimal usage of index
    ·         Is correct index being used for all large tables?
    ·         Is there any Full Table Scan on Large tables ?
    ·         Is there any unwanted Table being used in SQL ?
    ·         Evaluate Join condition on Large tables and their columns
    ·         Is FTS on large table b'cos of usage of non index columns
    ·         Is there any implicit or explicit conversion causing index not getting used ?
    ·         Statistics of all large tables are upto date ?
    Quick Resolution tips
    1) Use Bulk Processing feature BULK COLLECT with LIMIT and FOR ALL for DML instead of row by row processing
    2) Use Data Caching Technique/Options to cache static data
    3) Use Pipe Line Table Functions whenever possible
    4) Use Global Temporary Table, Materialized view to process complex records
    5) Try avoiding multiple network trips for every row between two database using dblink, Use Global temporary table or set operator to reduce network trip
    6) Use EXTERNAL Table to build interface rather then creating custom table and program to Load and validate the data
    7) Understand Oracle's Cost based Optimizer and Tune most expensive SQL queries with help of Explain plan
    8) Follow Oracle PL/SQL Best Practices
    9) Review tables and their indexes being used in the SQL queries and avoid unnecessary Table scanning
    10) Avoid costly Full Table Scan on Big Transaction tables with Huge data volume,
    11) Use appropriate filtration condition on index columns of seeded Oracle tables directly mapped to program parameters
    12) Review Join condition on existing query explain plan
    13) Use Oracle hint to guide Oracle Cost based optimizer to choose best plan for your custom queries
    14) Avoid applying SQL functions on index columns
    15) Use appropriate hint to guide Oracle CBO to choose best plan to reduce response time
    Thanks
    Praful

    I understand you were trying to post something helpful to people, but sorry, this list is appalling.
    1) Use Bulk Processing feature BULK COLLECT with LIMIT and FOR ALL for DML instead of row by row processing
    No, use pure SQL.
    2) Use Data Caching Technique/Options to cache static data
    No, use pure SQL, and the database and operating system will handle caching.
    3) Use Pipe Line Table Functions whenever possible
    No, use pure SQL
    4) Use Global Temporary Table, Materialized view to process complex records
    No, use pure SQL
    5) Try avoiding multiple network trips for every row between two database using dblink, Use Global temporary table or set operator to reduce network trip
    No, use pure SQL
    6) Use EXTERNAL Table to build interface rather then creating custom table and program to Load and validate the data
    Makes no sense.
    7) Understand Oracle's Cost based Optimizer and Tune most expensive SQL queries with help of Explain plan
    What about using the execution trace?
    8) Follow Oracle PL/SQL Best Practices
    Which are?
    9) Review tables and their indexes being used in the SQL queries and avoid unnecessary Table scanning
    You mean design your database and queries properly?  And table scanning is not always bad.
    10) Avoid costly Full Table Scan on Big Transaction tables with Huge data volume,
    It depends if that is necessary or not.
    11) Use appropriate filtration condition on index columns of seeded Oracle tables directly mapped to program parameters
    No, consider that too many indexes can have an impact on overall performance and can prevent the CBO from picking the best plan.  There's far more to creating indexes than just picking every column that people are likely to search on; you have to consider the cardinality and selectivity of data, as well as the volumes of data being searched and the most common search requirements.
    12) Review Join condition on existing query explain plan
    Well, if you don't have your join conditions right then your query won't work, so that's obvious.
    13) Use Oracle hint to guide Oracle Cost based optimizer to choose best plan for your custom queries
    No.  Oracle recommends you do not use hints for query optimization (it says so in the documentation).  Only certain hints such as APPEND etc. which are more related to certain operations such as inserting data etc. are acceptable in general.  Oracle recommends you use the query optimization tools to help optimize your queries rather than use hints.
    14) Avoid applying SQL functions on index columns
    Why?  If there's a need for a function based index, then it should be used.
    15) Use appropriate hint to guide Oracle CBO to choose best plan to reduce response time
    See 13.
    In short, there are no silver bullets for dealing with performance.  Each situation is different and needs to be evaluated on its own merits.

  • Help required in writing an sql to fetch the the difference of the data.

    Hi Gurus,
    Could some one help me in writing an sql to pull data the difference between two same structured tables from two different database and to store that data in an temperory table.
    many many thanks in advance

    Lets say you have two db SOURCE and DEST
    SOURCE is the DB that you have Logged in into. Now you do the following.
    1. Createa DBLink to DEST database.
    2. Check if the DBLink works properly.
    3. Then execute the following sql.
    select <column_list> from <table_name>
    minus
    select <column_list> from <table_name>@<dblink>
    union all
    select <column_list> from <table_name>@<dblink>
    minus
    select <column_list> from <table_name>

  • Oracle SQL/ PL-SQL help

    Dear Experts,
    If my below query returns any rows, I want this to trigger an alert, I'm writing a shell script to do this, need help how to implement the SQL part of it. I don't think IF EXISTS is directly supported in oracle, is there a PL/SQL alternative to check below query returns any rows and if so, I need to set an alert, with row data emailed out to group.
    select a.col1 from table1 a
    MINUS
    select b.col1 from table2 b;Thanks

    In a general case you should use the Stefanetti-Kyte method as suggested in {thread:id=2432829} where you could read:
    If a row is duplicated in A , then MINUS will "de-dup" it silently
    select *
      from (select 1 from dual union all
            select 1 from dual union all
            select 1 from dual union all
            select 2 from dual union all
            select 3 from dual
           ) a
           minus
           (select 1 from dual union all
            select 2 from dual union all
            select 3 from dual
           ) bRegards
    Etbin

  • Please help: how to connect to SQL Server Analysis Service (OLAP cube) with Crystal Re[ort XI

    I'm trying to connect to an OLAP cube on our SQL Server 2005 machine which is running Analysis Services (9.0).  When I am trying to use the Crystal Reports menu follow steps mentioned below:
    1) New report -> Standard Report Wizard
    2) Create New Connection -> OLAP -> Add
         Source Type: MS OLE DB Provider fir Analysis Service 9.0
    But when I click buttone 'Test', CR prompt me: The connection could not be establiched. Faild to set properties.
    HOWEVER: I can connect SQl Server Analysis Server with Excel and other Report tools.
    Our softwares are as mentioned following:
    - OS: Windows 2003 Server
    - SQL Server: SQL Server 2005 Enterprise
    - Crystal Reports XI Release 2 Developer Edition
    And SQL Server & Crystal Report are running in the same PC.
    Any help?

    Please re-post if this is still an issue with your OLAP Connectivity please post to Business Objects  » Other Business Objects Products Forum or purchase a case and have a dedicated support engineer work with you directly

  • Please help me in writing the SQL

    Hi,
    I am new to oracle.. Can you please help me in writing a SQL
    I have a table which has the following columns
    Start_date m1 ---- Start month of each quarter (Jan,Apr,Jul,oct)
    end_date m3---- End month of each quarter
    m1_start_date,
    m1_end_date,
    m2_start_date,
    m2_end_date,
    m3_start_date,
    m3_end_date,
    M1_act_rev,
    m2_act_rev,
    m3_act_rev
    If a user selects the dates from Jan,2011 to Jun, 2011
    I should get the aggregate of the revenues (m1+m2+m3+m1+m2+m3)

    Hi Gurus,
    Will this work
    select
    b.DISTRICT_NAME,
    count(c.CONTRACT_NUMBER),
    sum(C.M1_ACT_REV),
    sum(C.M2_ACT_REV),
    sum(C.M3_ACT_REV),
    sum(C.M1_EXP_PRICE),
    sum(C.M2_EXP_PRICE),
    sum(C.M3_EXP_PRICE)
    from
    clm_mn_compliance_data c,
    CLM_MN_CUSTOMER_ALIGNMENT_DATA b
    where
    ((m1_start_date between '01-01-2011' and '03-31-2011' ) and (m1_end_date between '01-01-2011' and '03-31-2011')) or
    ((m2_start_date between '01-01-2011' and '03-31-2011' ) and (m3_end_date between '01-01-2011' and '03-31-2011')) or
    ((m3_start_date between '01-01-2011' and '03-31-2011' ) and (m3_end_date between '01-01-2011' and '03-31-2011')) and
    b.CUSTOMER_ID = C.CUST_CTRT_ID
    group by
    B.DISTRICT_NAME;

  • Help!!!: catalog.sql and catproc.sql damage my db

    after running the file my.sql (see below), i encounter some error:
    when i try to edit the table data, the following error displayed:
    ORA-04045 ... SYS.DBMS_OUTPUT
    ORA-06508 ...
    ORA-06512 ...
    ORA-06508 ...
    ORA-06512 ...
    then i go to the package SYS.DBMS_OUTPUT, the status is "invalid", i try to recompile it, the following error displayed:
    ORA-04045 ... SYS.CDC_ALTER_CTABLE_BEFORE
    ORA-06508 ...
    ORA-06512 ...
    ORA-06508 ...
    ORA-06512 ...
    my db works well before running the file my.sql. it seems the execution of catalog.sql and catproc.sql cause the error. i am using 9i, and the document histories show that the catalog.sql and catproc.sql are last updated in Apr,2001.
    my questions are:
    1.with 9i db, do i need to run the two files?
    2.how can i recover my db?(i don't have backup, can i use redoXX.log?)
    ***my.sql***
    connect sys/change_on_install@orcl as sysdba
    @/opt/oracle/rdbms/admin/catalog.sql
    connect sys/change_on_install@orcl as sysdba
    CREATE database mydb
    @/opt/oracle/rdbms/admin/catproc.sql
    ***my.sql***

    how can i get my db work properly just as it was?
    what do you mean by "create database script"?
    Database configuration assistant allows you to create the database template and then save it as a set of scripts that you
    can later customize and run to create the database. If you created your "create database scripts" using this option then
    these scripts automatically run the catproc.sql and catalog.sql scripts along with several other scripts.
    If you use Database configuration assistant to create such a set of DB creation scripts, than look at the
    CreateDBCatalog.sql script, as you can see it runs both the scripts. so, if you do it this way, you do not need to do any
    extra steps (apart from your custom scripts that may be part of your post install steps).
    A sample of such DB creation script will be as below (for your reference):
    ===================================================================
    connect SYS/change_on_install as SYSDBA
    set echo on
    spool /home/oracle/Ora9i/assistants/dbca/logs/CreateDBCatalog.log
    @/home/oracle/Ora9i/rdbms/admin/catalog.sql;
    @/home/oracle/Ora9i/rdbms/admin/catexp7.sql;
    @/home/oracle/Ora9i/rdbms/admin/catblock.sql;
    @/home/oracle/Ora9i/rdbms/admin/catproc.sql;
    @/home/oracle/Ora9i/rdbms/admin/catoctk.sql;
    @/home/oracle/Ora9i/rdbms/admin/owminst.plb;
    connect SYSTEM/manager
    @/home/oracle/Ora9i/sqlplus/admin/pupbld.sql;
    connect SYSTEM/manager
    set echo on
    spool /home/oracle/Ora9i/assistants/dbca/logs/sqlPlusHelp.log
    @/home/oracle/Ora9i/sqlplus/admin/help/hlpbld.sql helpus.sql;
    spool off
    spool off
    exit;
    ===========================================================================

  • SQL to SQL Append

    Hi,
    I have a interface to load data from tables to table into same Oracle server, the target table is truncate every time that run interface and the data is just insert (don't update), i read that can use "IKM SQL to SQL Append" to avoid extra loading phases ( like flow tables, create index, etc. ). I put source table and datastore table from the same model, select "Staging Area Diferent from Target" and select the apropiate staging. The problem is that i can select the "IKM SQL to SQL Append" in the flow tab.
    Please can you help me with that ? i need this option to improve performance and space, every time that this interfaces run load aprox. 3 million of registers about 9 times with diferent conditions.
    Thanks.
    Juan Carlos Lopez
    Startegic Account Sales Consultant
    Oracle Venezuela

    Hola Juan, que tal estas?
    Eso es muy sencillo....
    Just import (or use if it is already imported) the KM Control Append and change the option "Flow Control" to No.
    Plus, let the Staging Area together at Target.
    I believe that will solve your problem because will generate just one step to load the data...
    If you have big problems on this, is very simple to change a KM....
    Un Saludo!
    Cezar Santos

  • Dilemma of an OCA (SQL, PL/SQL) with 4 years work-ex

    Dear all,
    I am an OCA(SQL, PL/SQL) and working on a enhancement/production support project (Tech: JAVA and Oracle, Func: Insurance) in my firm. I am doing quite well here and keep updating myself using oracle documentation and application functionality. But in a long term, I am confused about my career path, what should I do next? Should I upgrade myself with certification in advanced PL/SQL or should I move towards DBA activities or should I learn JAVA to be an software architect?
    Personally, I have great interest in oracle database, design and implementation, what can be a career path for a software architect?
    Please help.

    OracleDeft wrote:
    Dear all,
    I am an OCA(SQL, PL/SQL) and working on a enhancement/production support project (Tech: JAVA and Oracle, Func: Insurance) in my firm. I am doing quite well here and keep updating myself using oracle documentation and application functionality. But in a long term, I am confused about my career path, what should I do next? Should I upgrade myself with certification in advanced PL/SQL or should I move towards DBA activities or should I learn JAVA to be an software architect?
    Personally, I have great interest in oracle database, design and implementation, what can be a career path for a software architect?
    Please help.Bringing you PL/SQL up to OCP by studying for and taking 1z0-146 is probably a straightford and low impact descision.
    It may not however be in the route you wish to take your career, but it is relatively low cost and good gain.
    My impression is your not currently into Java ... learning that from the bottom may be a hard process and even having learn Java than in itself does not make one a software architect.
    Take a browse down all Oracle Certifications at [http://www.oracle.com/education/certification] ... certifications ... view all certifications ... but remember not all Oracle products / technologies have associated certifications.
    Consider SOA or BIEE or Oracle Application Express as well
    -

  • How to make code standardization in oracle 10 in sql/pl-sql

    if any body helps to handle how to make code standaridazation in oracle 10g in sql/pl-sql.

    refer tis link and get download..
    http://www.itap.purdue.edu/ea/data/standards/plsql.cfm

  • SQL, PL/SQL Expression and PL/SQL function

    In a Post Calculation Computation field I wanted the following computation:
    if B is X
    then
    field = A
    else
    field = B
    end if;
    or as a decode
    Decode(B,X,A,B)
    I could not get this to work so I wrote a database function that simulates the decode. So when I put:
    My_decode(B,X,A,B)
    in the field it did work.
    Basically I am not sure what kind of code one is expected to put into SQL, PL/SQL Expression and PL/SQL function fields. Can someone give an example of each? Also the APEX help is sometimes incorrect.
    For example if you click the "Post Calculation Computation" label it says:
    The For example, if this item is named P1_X, you could use post calculation expressions such as UPPER(:P1_X), INITCAP(:P2_Y), MIN(:P1_X,:P2_Y-200), NVL(:P1_X,:P2_Y), or a function call such as return my_func(:P1_X); to set the final value of the item.
    But if you put return my_func(:P1_X); in the field you get an error. It should be just my_func(:P1_X);
    thanks Rene

    DECODE is only available in SQL, so would have to be used in a SQL Expression.Yes, that's what APEX keeps telling me when I use in in a field that has "SQL or PL/SQL expression" above it. So what do you put in the field?

  • Learning PL/SQL with SQL plus

    I'm looking to teach myself PL/SQL with SQL Plus, it's a works pc so I can not use any other software than SQL plus.
    When starting SQL plus I'm asked for a username, password and host string.
    I'm taking it the host string is the db I want to connect to and obviously supply the username and password for level of access?
    Also what I ideally need is a sample db on my local machine to connect to with SQL plus to learn that way.
    Can anyone point me in the right direction please. Any help is greatly appreciated.

    Use the net8 configuration assistant preferably as it'll get the syntax correct.
    Otherwise you copy the sample one up one folder and edit that.
    Connection information (SID, Server/IP, port number) you'll have to get off your DBA.
    The name at the start of a tnsnames entry is the name that you want to reference the database as, so you can call it FRED if you like.
    e.g.
    FRED =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS =
            (PROTOCOL = TCP)
            (HOST = <server name or ip address>)
            (PORT = <port>) -- usually 1521 but can differ if more than one instance on the server
        (CONNECT_DATA =
          (SID = <database SID>) -- the name of the database on the server.
      )Once that's set up you can then log onto the database in the following way:
    sqlplus <user>/<password>@fred
    What happens is that the TNS Listener service (that should be running on your PC) will look up "fred" in the tnsnames.ora file and then use the information from that to make the connection to the server on the correct port and connect you to the actual database on there.
    After that.... it's up to you.
    :)

  • Need a query to compile .sql from sql+

    Hi All,
    I need to run a .sql file from sql+plus .
    So share me the query to do this.

    1011786 wrote:
    Hi All,
    I need to run a .sql file from sql+plus .
    So share me the query to do this.
    Hi
    SQL> select dummy,sysdate from dual;
    D SYSDATE
    X 11-JUN-2013
    SQL> save test_dual.sql
    Created file test_dual.sql
    SQL> @test_dual.sql
    D SYSDATE
    X 11-JUN-2013
    SQL>
    Hope this helps
    Regards,
    Achyut Kotekal

  • Java.sql.SQLException: SQL string is not Query

    Hi I'm Very much new to Jdeveloper
    I create a an application Which uses Jakarta Struct. that Aplication works fine on tomcat. But when I tried to run that application(using embeded OC4J) It gave me the following error
    java.sql.SQLException: SQL string is not Query
    it will throw on the following statement
    rs = statement.executeQuery(strSqlQuery);
    I print the sql Statement and run it manully. then it work perfectly
    pl help me
    Thanks
    Charith
    the Method is as follows
    public static boolean add(String pstrName, String pstrAge)
    boolean boolResult= false;
    Connection con = null;
    Statement statement = null;
    ResultSet rs=null;
    String strSqlQuery= "insert into a_upul(age, name11) values('"+pstrAge+"','"+pstrName+"')";
    //PreparedStatement stmt = null;
    con =dbmanager.newCon();
    try {
    statement = con.createStatement();
    System.out.println("strSqlQuery "+strSqlQuery);
    rs = statement.executeQuery(strSqlQuery);
    boolResult=true;
    }catch (SQLException e){
    e.printStackTrace();
    boolResult=false;
    finally {
    try{
    if (rs != null)
    rs.close();
    if (statement != null)
    statement.close();
    if (con != null)
    con.close();
    }catch (SQLException e) {
    e.printStackTrace();
    System.out.println("ProjectManager->getDistinctConSeqNoFromTMPSHL_2 method : " + e.toString());
    return boolResult;
    }

    Hi,
    I am using OC4J 10g (9.0.4) - J2EE 1.3 Compatible server to run my ejb, while executing I am getting the following error.
    java.lang.NullPointerException
    at oracle.jdbc.driver.ScrollableResultSet.close(ScrollableResultSet.java:149)
    at com.evermind.sql.FilterResultSet.close(FilterResultSet.java:338)
    The same ejb is working fine with weblogic server.
    Thanks,
    Santo

  • Coneection between Oracle to SQL and SQL to Oracle

    Dear All,
    I have oracle 11g R2 (32 bit) on windows 32 bit.
    I have sql express edition 2008 (32 bit) on windows 32 bit.
    More information about my system is :-
    I have install oracle database and sql database on same machine (there is no client).
    I want to fetch data from oracle to sql and sql to oracel. I have tried Using ODAC 32 bit but with no luck.
    steps i have performed:-
    1) Install odac for windows for oracle 11g R2 version (successful).
    2) Tried to create odbc connection using odbc driver (successful).
    3) Tried to create link server in sql (successful).
    4) Tried to connect to oracle using link server (failed).
    It seems i made some small mistake.
    I request you to please help me if you have perform this activity.
    Thanks,
    Chanchal Wankhade.

    Chanchal Wankhade wrote:
    Hello,
    Please suggest.
    =================================
    Patience, Grasshopper
    You posted this follow-up a mere 85 minutes after your previous post. 
    This forum is not a chat line, and it is not paid support. 
    No one is responsible for monitoring it and giving a quick response. 
    Furthermore, it is a global forum.  The person with the information you seek may very well live 20 time zones away from you and was going to bed just as you posted. He will not even see your post for several more hours. 
    Your original post went up in the middle of the night for half the world.
    No one with the information you seek is deliberately withholding it until you sound sufficiently desperate.

Maybe you are looking for