PL/SQL - Oracle / Toad

Hi Experts
I need some HELP..please
I need to match table 2 to table 1 on groupid (table 2) and shortgroup (table1) fields. Problem is that shortgroup has multiple group codes. Basically I need to show what groups user aaaaa has access to etc
Table1:
ENTRYID     USERNAME EMAIL     SHORTGROUP
000000000000900 aaaaa     [email protected]     1820;1150;1806;
000000000000470 bbbbb     [email protected]     1820;1807;1150;1806;
000000000000695 cccccc     [email protected]     1807;1150;1805;1806;
Table 2:
GROUPID     GROUPNAME (group description)
1805     Text 1
1806     Text 2
1807     Text 3
1820     Text 4
1150     Text 5
Thanks in advance

Like this...
SQL> with table1 as (select '000000000000900' as entryid, 'aaaaa' as username, '[email protected]' as email, '1820;1150;1806;' as shortgroup from dual union all
  2                  select '000000000000470','bbbbb','[email protected]','1820;1807;1150;1806;' from dual union all
  3                  select '000000000000695','cccccc','[email protected]','1807;1150;1805;1806;' from dual)
  4      ,table2 as (select 1805 as groupid, 'Text 1' as groupname from dual union all
  5                  select 1806, 'Text 2' from dual union all
  6                  select 1807, 'Text 3' from dual union all
  7                  select 1820, 'Text 4' from dual union all
  8                  select 1150, 'Text 5' from dual)
  9  -- end of test data
10  select table2.groupname
11  from   table1, table2
12  where  instr(table1.shortgroup,to_char(table2.groupid,'fm9999')||';') > 0
13  and    table1.username = 'aaaaa'
14  /
GROUPN
Text 2
Text 4
Text 5
SQL>

Similar Messages

  • XML Publisher(XDODTEXE) in EBS taking more time with the same SQL in TOAD

    HI
    XML Publisher(XDODTEXE) in EBS taking more time with the same SQL in TOAD.
    The sql has 5 union clauses.
    It takes 20-30 minutes in TOAD compared to running through Concurrent Program in XML Publisher in EBS taking around 4-5 hours.
    The Scalable Flag at report level is turned on with the JVM options set to -Xmx1024m -Xmx1024m in Concurrent Program definition.
    Other configurations for Data Template like XSLT, Scalable, Optimization are turned on though didn't bounce the OPP Server for these to take effect as I am not sure whether it is needed.
    Thanks in advance for your help.

    But the question is that how come it is working in TOAD and takes only 15-20 minutes?
    with initialization of session ?
    what about sqlplus ?
    Do I have to set up the the temp directory for the XML Publisher report to make it faster?
    look at
    R12: Troubleshooting Known XML Publisher and E-Business Suite (EBS) Integration Issues (Doc ID 1410160.1)
    BI Publisher - Troubleshooting Oracle Business Intelligence (XML) Publisher For The Oracle E-Business Suite (Doc ID 364547.1)

  • Query LDAP from Oracle Toad

    Hi friends,
    Can you please help me how to use sql query (select statement) from Oracle TOAD to query and retrieve records from LDAP?
    Thank you.

    Hello 13281540,
    why do you ask a question about Toad (a tool from Quest-software) in a forum about SQL-Developer (a tool from Oracle)?
    Regards
    Marcus

  • Pl-Sql Oracle Function Concurrency Issue

    Hi All,
    Issue - pl-sql Oracle Function performance issue, when muliple users are accessing the function
    Detail -
    Oracle 11g / Linux Server
    I have developed a pl-sql oracle function to retrieve information from 3 tables, output as a particluar type array.
    Single request is getting processed within 2.2 seconds, but when multiple request are sent concurrently <tested with 50>, time taken for each output is different.
    BreakUp of Response times:-
    8 messages took - 2.2 sec
    +8 messages took - 4.4 sec
    ++8 messages took - 6.6 sec....etc
    I'm looking for any DB tunning parameter, which will help to resolve this issue.
    My only aim is to expose developed function to multiple users, who all can access it concurrently, but response should limit within 2.2 seconds.
    Any thoughts + guidance is higly appreciated.
    Thanks
    Preetam Singh

    Supporting data insert statements:
    =======================================================================================================================
    REM INSERTING into EXPERTISE
    Insert into EXPERTISE (USH_USER_NAME,USH_SKILL_SET1,USH_SKILL_SET2,USH_SKILL_SET3,USH_SKILL_SET4,USH_SKILL_SET5,USH_SKILL_SET6,USH_SKILL_SET7,USH_SKILL_SET8,USH_SKILL_SET9,USH_SKILL_SET10,USH_SKILL_SET11,USH_SKILL_SET12,USH_SKILL_SET13,USH_SKILL_SET14,USH_SKILL_SET15,USH_SKILL_SET16,USH_SKILL_SET17,USH_SKILL_SET18,USH_SKILL_SET19,USH_SKILL_SET20) values ('A','ENGLISH','FRENCH','HINDI',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into EXPERTISE (USH_USER_NAME,USH_SKILL_SET1,USH_SKILL_SET2,USH_SKILL_SET3,USH_SKILL_SET4,USH_SKILL_SET5,USH_SKILL_SET6,USH_SKILL_SET7,USH_SKILL_SET8,USH_SKILL_SET9,USH_SKILL_SET10,USH_SKILL_SET11,USH_SKILL_SET12,USH_SKILL_SET13,USH_SKILL_SET14,USH_SKILL_SET15,USH_SKILL_SET16,USH_SKILL_SET17,USH_SKILL_SET18,USH_SKILL_SET19,USH_SKILL_SET20) values ('B',null,'GERMAN','CHINIESE','HINDI',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    Insert into EXPERTISE (USH_USER_NAME,USH_SKILL_SET1,USH_SKILL_SET2,USH_SKILL_SET3,USH_SKILL_SET4,USH_SKILL_SET5,USH_SKILL_SET6,USH_SKILL_SET7,USH_SKILL_SET8,USH_SKILL_SET9,USH_SKILL_SET10,USH_SKILL_SET11,USH_SKILL_SET12,USH_SKILL_SET13,USH_SKILL_SET14,USH_SKILL_SET15,USH_SKILL_SET16,USH_SKILL_SET17,USH_SKILL_SET18,USH_SKILL_SET19,USH_SKILL_SET20) values ('C','ENGLISH',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null);
    =======================================================================================================================
    ==================================================================
    REM INSERTING into WORKING
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','MON','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','TUE','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','WED',null,null);
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','THU','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('A','FRI','09:00','12:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','MON','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','TUE','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','WED','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','THU','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('B','FRI','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','MON',null,null);
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','TUE','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','WED','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','THU','09:00','18:00');
    Insert into WORKING (NAME,WEEKDAY,DAYSTARTTIME,DAYENDTIME) values ('C','FRI','09:00','12:00');
    ==================================================================
    =====================================================================================================================
    REM INSERTING into SCHEDULE
    Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'MEETING','A');
    Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'TRAINING','B');
    Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('13-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'MEETING','A');
    Insert into SCHEDULE (APPOINTMENTDATE,APPOINTMENTSTART,APPOINTMENTEND,STATUS,NAME) values (to_timestamp('11-FEB-12 10.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-FEB-12 11.30.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'MEETING','B');
    =====================================================================================================================
    Edited by: 910614 on Feb 10, 2012 9:29 AM

  • Can i Use two qery hints in one SQL(Oracle)?

    Hi,
    Can i Use two Query hints in one SQL(Oracle)? USE_HASH and No_Merge
    Thanks

    user10916886 wrote:
    Can I use like
    /*+ USE_HASH(X,Y) NO_MERGE(X) */
    will this work?Not really: NO_MERGE relates to mergeable views, not base tables. So whilst the USE_HASH may result in a hash join between the tables X and Y, USE_MERGE will be ignored for X.
    As hoek says, however, HINTs should be a last resort only, and if they're to be used at all you're best to stay with those that don't involve explicit objects, like ALL_ROWS, FIRST_ROWS_10, etc.
    user10916886 wrote:
    Im my database, if i don't use query hints. The expalin plan uses Nested loops, hence the query takes a lot of time.You would be better trying the ALL_ROWS hint here, instead of USE_HASH.
    Edit
    The optimizer, however, will have chosen NESTED LOOPs where it did because it believed that to be the most efficient data retrieval path with the information that it had to hand. So, if your statistics are comprehensive and up-to-date, yet the optimizer is continually opting for the less efficient plan, there's something else wrong, and HINTs are only masking that problem in the short-term.

  • Native and open  sql - oracle

    hi all,
    <dynamic >  = SELECT matnr  FROM mara .
    EXEC SQL.
      OPEN c1 FOR <dynamic >ENDEXEC.
    ENDEXEC.
    can  i use dynamic native sql in open sql-oracle .
    cheers
    senthil

    EXEC SQL doesn't allow for dynamic constructs. In order to get native SQL features dynamically you can use the JDBC-like classes CL_SQL_STATEMENT, CL_SQL_CONNECTION, and so on.
    Best regards
      Ulrich

  • PI - SQL ORACLE TO RFC

    Hi!
      I am studing PI and I have a question.
      I create a process to select a table in SQL Oracle
      and to send to the RFC.
      I run (Test ) the process and it is a erro.
    Step 1.  Send agreement
    Log.
    <Trace level="1" type="B">SENDER AGREEMENT SIMULATION</Trace>
    <Trace level="1" type="T">Simulating Adapter Engine...</Trace>
    <Trace level="1" type="T">Simply trying to loolup for the most specific Sender Agreement object</Trace>
    <Trace level="1" type="T">no objects found</Trace>
    <Trace level="1" type="T">Note that real results may differ</Trace>
    Stpe 2.  Receice Determination
    Runtime error
    "Die Nachricht ist unvollständig. Es wurde kein Sender gefunden."
      =  "The message is incomplete. There was no station is found."
    Your change list is not empty; activate changes before simulation
    <Trace level="1" type="B">CL_RD_PLSRV-ENTER_PLSRV</Trace>
    <Trace level="1" type="T">R E C E I V E R - D E T E R M I N A T I O N </Trace>
    <Trace level="1" type="T"> Cache Content is up to date </Trace>
    <Trace level="1" type="E">CL_RD_PLSRV-ENTER_PLSRV</Trace>
    May you help me? Where is it the problem?
    Thanks.

    Hi Clayton,
    Are you using the ICO object or the classic configuration (SA, RD, ID, RA)?, with the ICO object the ID test doesn't work.
    For the test, are you generating the right sender XML payload?, have you set the receiver fields in the ID test? (Configuring the Sender JDBC Adapter - Configuring the JDBC Adapter in the Integration Directory/PCK - SAP Library)
    Personally, i usually test the JDBC sender scenario directly, setting up the channel; but i dont see any reason because the ID test with a classical configuration wouldn't work.
    Regards.

  • How to see variable Data at the time debugging procedure in oracle toad 9.1

    Hi all,
    I am not able to see variable Data at the time of debugging procedure in oracle toad 9.1 .
    Any help would be appreciated .
    Regards,
    P Prakash
    Edited by: prakash on May 30, 2011 1:37 AM
    Edited by: prakash on May 30, 2011 1:37 AM
    Edited by: prakash on May 30, 2011 1:37 AM

    You might be aware Toad is not an Oracle product, so you need to post this at the forums of Quest, http://www.questsoftware.com
    Sybrand Bakker
    Senior Oracle DBA

  • How to create scheduler sql oracle developer

    Hi
    how to create How to create scheduler sql oracle developer?

    Hi
    finally i refer below link its usefull
    ORACLE-BASE - SQL Developer 3.1 Scheduler (DBMS_SCHEDULER) Support

  • 很全的help.sql 安装Oracle的sqlplus帮助系统

    在linux系统下的时候,我们可以通过man命令,获得系统里对某个命令的usage的解释。
    在sqlplus里我们也可以通过help和?命令。
    sqlplus的帮助主题对应的是数据库里的一张表(system.help)。
    在$ORACLE_HOME/sqlplus/admin/help/目录下的helpus.sql包含了这个表的帮助主题
    不过oracle自带的help和?的解释太少了
    在网上找了很久终于找到一个很全的help.sql叻
    下载文中附件,用system登录,因为这个是建立在system的schema里的help表里的。
    直接执行脚本就可以了。比如我把这个sql保存到$ORACLE_HOME\sqlplus\admin\help里,
    大家在这里可以看到有
    helpbld.sql
    helpdrop.sql
    helpus.sql
    hlpbld.sql
    这四个文件,这就是oracle自带的help脚本。可以执行
    helpbld.sql来安装oracle默认的help, 这里会提示你输入两个参数,看了这个源文件。
    两个参数一个是当前路径,一个是helpus.sql, 还是用system来执行,执行完就安装了help,
    就可以使用我上面的那些方式。这个是默认会安装的。
    要安装我这个最新的help文件,只需要执行就可以了
    SQL>conn system/systempwd;
    SQL>@?/sqlplus/admin/help/helpbld.sql
    输入 1 的值: F:\developer\oracle\product\10.2.0\db_1\sqlplus\admin\help
    输入 2 的值: F:\developer\oracle\product\10.2.0\db_1\sqlplus\admin\help\help.sql
    这里就会执行了,执行是有一些和默认的有冲突,可以忽略这些错误。
    成功以后,我们执行一下
    SQL> select count(*) from system.help ;
    COUNT(*)
    5085
    呵呵呵一下多了好多条了哟
    SQL> help create database;
    引用:
    CREATE DATABASE
    Use this command to create a database, making it available for
    general use, with the following options:
    * to establish a maximum number of instances, data files, redo
    log files groups, or redo log file members
    * to specify names and sizes of data files and redo log files
    * to choose a mode of use for the redo log
    * to specify the national and database character sets
    Warning: This command prepares a database for initial use and erases
    any data currently in the specified files. Only use this command
    when you understand its ramifications.
    .......这里还要好多有关create table的帮助信息,我就不写了。
    有了这个帮助系统,要查一个命令的详解,正是太方便叻。
    help.sql文件【 下载 】

  • Oracle Toad 9.0- selection of rows based on timestamp

    Hi,
    I am using Oracle Toad 9.0 and am trying to pull records based on the timestamp they were modified.
    To be more specific, i want to pull out the objects which were modified between 28th March 2011 and April 3rd 2011.
    In my understanding it should return rows which were modified between 12 am 28th March till 11.59pm April 3rd,
    Please let me know if this is correct..
    If this is correct then i have a problem where the objects modified on April 3rd(12.00am to 11.59pm) are not being pulled.
    Query used:
    select * from tablename where cast(obj_mod_dt as date) between '28-Mar-2011' and '03-Apr-2011'
    -- Results have objects modified from 28th March 12.00am to 02 Apr 11.59pm
    Please let me know on why it behaves indifferently.

    select * from tablename where cast(obj_mod_dt as date) between '28-Mar-2011' and '03-Apr-2011'Is obj_mod_dt not already a DATE datatype?
    Why are you comparing a DATE to strings?
    I think perhaps you are looking more for something like this:
    select *
    from tablename
    where cast(obj_mod_dt as date) between to_date('28-Mar-2011','DD-Mon-YYYY') and to_date('04-Apr-2011','DD-Mon-YYYY')-(1/86400)or
    select *
    from tablename
    where cast(obj_mod_dt as date) >= to_date('28-Mar-2011','DD-Mon-YYYY')
    and cast(obj_mod_dt as date) < to_date('04-Apr-2011','DD-Mon-YYYY')Of course if obj_mod_dt is already a date column then there's no need to cast it.
    If it's not a date column, then what is it? Is it varchar2? If so you should be explicit in the conversion to a DATE datatype e.g.
    where to_date(obj_mod_dt,'DD-Mon-YYYY') ...and ensure you specify the correct date format for it.
    Otherwise you are relying on implicit datatype conversions and it's likely that it'll break somewhere.

  • Data insert in SQL & ORACLE databases

    Hi
    We are sending vendor master data from SAP to SQL & ORACLE database .
    It is working successfully for SQL.
    we have deployed oracle drivers, completed the configuration part.
    When idoc is triggered in SAP,data is uploaded in SQL successfully....but it is showing the following error for Oracle....
    ....." Unable to execute statement for table or stored procedure. 'tblVendorAddress' (Structure 'Table') due to java.sql.SQLException: FATAL ERROR: Column 'cVendorCode' does not exist in table 'tblVendorAddress' "......
    cVendorCode in SQL is defined as cVendorCode ... but in Oracle it is defined as CVENDORCODE...
    If  i change the datatype in XI as CVENDORCODE...my SQL scenario will not work(cVendorCode)..
    I don't want to change my XI datatype structure....records should be updated in SQL & Oracle datadase at the same time.
    Please suggest a solution..
    Regards
    Abhijit

    Hi!
    As far as I know this is the only way, because the PI works like all Java based systems (and unix systems) case-sensitive.
    But maybe there is a "Wizard" in this forum who knows another way
    Regards,
    Volker

  • XML to SQL (oracle) Parallel Processing Scenario

    hi,
    I have one scenario to load datas from XML to SQL but when this scenario runs in parallel duplicate information.
    I have done tests with 5 xml file these xml file have unique header_id but when run in parallel , insert 5 record in target table but one is repeat.
    the flow is the following,
    1. My scenario recieved one variable (name xml file), this variable is sent for bpel.
    2. Load datas from xml to sql(oracle), in this step I have concatenated to tables C$_, I$ and E$_ the session number how explain this link http://odiexperts.com/?p=1417.
    3. Invoke web service with status finished.
    I have tried the following.
    after of first step I set a procedure with sentence "SYNCHRONIZE schema SO from file" and modify my topology to &ro=true some time run perfect but check the target table and datas are duplicated and other time catch the error ....
    0 : null : java.sql.SQLException: class org.xml.sax.SAXException
    class java.lang.NullPointerException said null.
    Any suggestion o coment to execute my scenario in parallel?
    Thanks a lot.
    Antonio

    Please repost in the Data Integrator forum Data Integrator
    (this forum is for Data Service Integrator - an entirely different product).

  • Difference   LDAP & SQL & ORACLE

    Hi All
    I'm currently working in a messaging environment which
    includes LDAP Server and here i want to know the difference
    bettween LDAP - SQL - ORACLE.
    The Read access is faster in LDAP than write ? is it correct ??
    & i think in SQL write access is faster that read acess ?? is it correct??
    My Ques..
    1) If Any body know difference between LDAP,SQL & ORACLE ?
    kindly let me know ??
    Thanks in Advance.

    LDAP is a standard defined at IETF (RFC 4510 and associated)
    It is derived from the ISO-ITU standard X.500 and has a hierarchical, object oriented model.
    Sun Directory Server implements LDAP.
    SQL is a query language to access relational databases.
    Oracle is a company which has several products including a relational database, an LDAP server (Oracle OID).
    For more details, I would suggest a simple search on the internet for "LDAP vs RDBMs". There are many well written articles available.
    Regards,
    Ludovic.

  • Pl sql---sql---oracle sql

    whats the difference between
    sql
    pl/sql
    oracle sql??

    You can google it and get the answer
    Both SQL and PL/SQL are languages used to access data within Oracle databases.
    SQL is a limited language that allows you to directly interact with the database. You can write queries (SELECT), manipulate objects (DDL) and data (DML) with SQL. However, SQL doesn't include all the things that normal programming languages have, such as loops and IF...THEN...ELSE statements.
    PL/SQL is a normal programming language that includes all the features of most other programming languages. But, it has one thing that other programming languages don't have: the ability to easily integrate with SQL.
    Some of the differences:
    SQL is executed one statement at a time. PL/SQL is executed as a block of code.
    SQL tells the database what to do (declarative), not how to do it. In contrast, PL/SQL tell the database how to do things (procedural).
    SQL is used to code queries, DML and DDL statements. PL/SQL is used to code program blocks, triggers, functions, procedures and packages.
    You can embed SQL in a PL/SQL program, but you cannot embed PL/SQL within a SQL statement

Maybe you are looking for

  • Two apple ID's, one has purchased additional storage

    I have two apple ID's--one on my iPhone and one on my iPad. I only want ONE. I realize they can't be combined. I have bought storage on my iPad that NOTHING has been synced to, it needs to be purchased on my iPhone instead. I want to have just ONE ap

  • Csv-export with dynamic filename ?

    I'm using the report template "export: CSV" to export data to a csv-file. It works fine with a static file name. Now, I would like to have a dynamic file name for the csv-file, e.g. "ExportData_20070209.csv". Any ideas ?

  • How to specify in the command file?

    Hi all, I have to run some ORACLE reports(Oracle reports ver 3.0 and Oracle database ver 8.1.7.1.0 )and an electronic report depending on the parameters specified in the report request table. How can I specify in the command file using IF then logic

  • Attempting to apply Patch 5639232 to 10.2.0.2 client

    When the client was installed, OPatch was not installed. Patch will not install without OPatch. Has anyone experienced this problem? How did you work around the missing OPatch?

  • Syncing iphone 3 to itunes

    I want to sync my iphone 3 to itunes so that all the contacts/photos/music can be transferred to my new iphone 4, I'm a bit worried that if I sync my phone to itunes all of this will be deleted?