Dynamic query to drop apps schema

Hi,
We are having a test ERP instance and we are refreshing it with ERP PROD export data through import on ERP test instance.
Now we want to drop all Oracle apps schema only in our test instance and through Import they will get created again.
Is there some dyanmic query through which i can drop only all apps schema.
Please help it is urgent.
Your help is appreciated.
Regards,
Milan

Now we want to drop all Oracle apps schema only in our test instance and through Import they will get created again.
Is there some dyanmic query through which i can drop only all apps schema.You cannot drop apps schema only due to data/object dependencies, so there is no such a query as your approach is not supported.
The only supported way is to install a new fresh database (standalone database), and export all EBS schemas from any other instance and import it to this new database. Or, use Rapid Clone to duplicate your database.
Thanks,
Hussein

Similar Messages

  • Dynamic query with drop down lists

    I have two select queries in my program.
    The first query is to obtain and then display the list of
    clients.
    The second query I want to display only projects which are
    linked to a specific client.
    <cfquery name="getClient" datasource="#request.DSN#">
    Select tblClients.ClientID, tblClients.ClientName
    From tblClients
    Order by tblClients.ClientName</cfquery>
    <cfquery name="getProjects" datasource="#Request.DSN#">
    Select tblprojects.ProjectID, tblProject.Project,
    tblProject.ProjectID
    From tblProject, tblClients
    WHERE tblClients.ClientID = tblProject.ClientID AND
    tblClients.ClientID = #getClient.ClientID# </cfquery>
    I am displaying the first select box ok and it is populated
    with the correct information.
    The second select box is ot quite correct. It is only
    displaying one record - the first record in the file.
    <select name="Client">
    <cfoutput query="getclient">
    <option
    value="#getclient.ClientID#">#getclient.ClientName#</option>
    </cfoutput>
    </select>
    <select name="Project">
    <cfoutput query="getProject">
    <option
    value="#getProject.ProjectID#">#getProject.Project#</option>
    </cfoutput>
    </select>
    Any ideas on how to correct this would be greatly
    appreciated.
    Kind regards

    In your second query you are using the variable
    #getClient.ClientID#
    Outside of a <cfloop query=""> or a <cfoutput
    query=""> CF assumes you meant
    : #getClient.ClientID[1]# (which is the first record of the
    getClient Query.
    If you are trying to pull up a list of projects that are for
    the getClient list, then try this instead
    <cfquery name="getProjects" datasource="#Request.DSN#">
    Select tblprojects.ProjectID, tblProject.Project,
    tblProject.ProjectID
    From tblProject, tblClients
    WHERE tblClients.ClientID = tblProject.ClientID AND
    tblClients.ClientID IN (#valuelist(getClient.ClientID)#)
    </cfquery>
    Valuelist changes any 'column' from a query into a list.
    Hope this helps

  • Query hangs when getting apps schema objecs(Ebs R12) objects from BO Designer

    Hello Guys,
    We are facing an issue on Production instance that the query given by BO support hangs when getting the objects from apps schema by login from BO designer.
    We are able to get the objects from Ebs 11i instance with the same query. Below is the instances details for Ebs 11i and R12.
    Ebs R12 Application Version     : 12.1.3
    Ebs R12 DB Version                 : 11.2.0.3
    Ebs 11i Appl Ver     : 11.5.9
    Ebs 11i DB Ver       : 9.2.0.5
    Below is the query.
    SELECT NULL, u1.owner, u1.object_name, u1.object_type, NULL
        FROM all_objects u1, role_tab_privs rtp, all_tab_privs atp
       WHERE u1.object_type IN ('TABLE', 'VIEW', 'SYNONYM')
         AND u1.object_name LIKE '%' /* Type selection : can be empty */
         AND u1.owner = rtp.owner(+)
         AND u1.object_name = rtp.table_name(+)
         AND u1.owner = atp.grantee(+)
         AND 'SELECT' = atp.PRIVILEGE(+)
         AND u1.object_name = atp.table_name(+)
         AND u1.owner = 'APPS' /* Owner selection : can be empty */
    UNION
    SELECT   NULL, asy.owner, asy.synonym_name, 'SYNONYM', NULL
        FROM all_synonyms asy
       WHERE asy.synonym_name LIKE '%' /* Type selection : can be empty */
         AND asy.owner = 'APPS' /* Synonym Owner selection : can be empty */
    ORDER BY 4, 2, 3;
    Please help me out as it's very urgent. As users are unable to do transaction.
    Thanks
    Khan

    Any update experts on this issue please

  • FOR XML to generate dynamic script to drop multiple tables

    Log_Table has a column named Col1 where we have table names
    Col1
    TableA1
    TableA2
    TableA3
    TableB1
    TableC1
    TableC2
    Generate dynamic script to drop tables that are in Log_Table and starts with TableA.
    Instead of using the loop, use For XML

    Thanks Visakh16 [+1],
    you are right there was typo mistake :-) I forgot the variable in the end, and Thanks Naomi [+1],
    this is true and better to use quotename or just add brackets. Actually I will not choose this approach since we chould use schema as well. the DDL in the OP is not something that I will create probably.
    In any case, here is the fixed query (current approach):
    declare @SQLString NVARCHAR(MAX)
    SELECT
    @SQLString = (select
    N'IF OBJECT_ID (N''' + CAST([Col1] AS VARCHAR(MAX)) + N''') IS NOT NULL drop table [' + CAST([Col1] AS VARCHAR(MAX)) + N']; '
    FROM Log_Table
    WHERE (Col1 like 'TableA%')
    FOR XML PATH (''))
    --print @SQLString
    EXECUTE sp_executesql @SQLString
    GO
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Error while running Re-create grants and synonyms for APPS schema

    Hi,
    I have upgraded customer's Oracle Apps 11i (11.5.10) database to Oracle 10g R2. While executing '+Re-create grants and synonyms+ ' as given in Note: 362203.1, I am gettng error:
    plus80 -s APPS/***** @E:\EBSTEST\ebstestappl\ad\11.5.0\admin\sql\adappsgs.pls &systempwd 1 INV APPLSYS APPS TRUE FALSE TRUE
    Error:
    Program exited with status 3
    Cause: The program terminated, returning status code 3.
    Action: Check your installation manual for the meaning of this code on this operating system.Connected.
    old 2: ad_apps_private.create_grants_and_synonyms(&2,'&3','&4','&5','FALSE');
    new 2: ad_apps_private.create_grants_and_synonyms(1,'INV','APPLSYS','APPS','FALSE');
    begin
    *+
    ERROR at line 1:
    ORA-20000: ORA-00955: name is already used by an existing
    object:create_grants_and_synonyms(1,INV,APPLSYS,APPS): create_base_gs(INV,APPS): In Synonyms
    Loop:create_synonym(INV,MTL_ONHAND_DISCREPANCY,APPS,MTL_ONHAND_DISCREPANCY):
    do_apps_ddl(APPS,CREATE SYNONYM "MTL_ONHAND_DISCREPANCY" FOR INV."MTL_ONHAND_DISCREPANCY"):
    ORA-06512: at line 5
    MTL_ONHAND_DISCREPANCIES
    I checked the database and there isn't MTL_ONHAND_DISCREPANCY synonym. But there is MTL_ONHAND_DISCREPANCIES synonym.
    This is an upgraded instance from 11.0.3 and first time I am running Re-create grants and synonyms for APPS schema.
    Plz let me know if anyone of you faced this issue.
    Rgds,
    Thiru

    Hi,
    there is no such table MTL_ONHAND_DISCREPANCY or synonym in Applications 11.5.10.2. Is that custom table created in your db?
    After dropping this table from APPS schema 'Re-create grants and synonyms for APPS schema' went thru fine.Its correct
    This table does not exist in INV schema in 11.5.10.2.
    Could be possible that the consultant could have created this table in INV and APPS schema by mistake or whatever.Yes, with the same name, there might be table in APPS SCHEMA. When you run recreate grants and synonyms, adadmin tries to create synonym for that table in APPS schema. since there is object available with the same name in apps chema, you got that error.

  • Dynamic Query

    Dynamic Query
    When I run the following dynamic query in the stored procedure and try to build the report then I get the following error Rep:1401 Fatal PL/SQL error occured, Ora-00936 Missing expression. When I am generating the report standalone using the following query , everything is working fine but in Stored procedure , it's giving me the above error, pls help.
    create or replace package REP_DELIVERY_LOC_STATISTICS is
    TYPE REP_DELIVERY_LOC_STAT_rec IS RECORD(
    p_coordinating_facility_id sis_education_pgm_session.coordinating_facility_id%TYPE,
    p_PSE_MUNICIPALITY_ID pse_education_pgm_session.PSE_MUNICIPALITY_ID%TYPE,
    p_pse_education_pgm_session_id sis_education_pgm_session.pse_education_pgm_session_id%TYPE,
    p_course_session_id course_session.course_session_id%TYPE);
    TYPE REP_DELIVERY_LOC_STAT_cur IS REF CURSOR RETURN REP_DELIVERY_LOC_STAT_rec;
    Type REP_DELIVERY_LOC_STAT_cur_Dyn is REF CURSOR;
    FUNCTION REP_DELIVERY_LOC_STATISTICS(p_college_id IN pse_education_pgm_session.delivery_institution_id%TYPE,
    p_start_date IN pse_education_pgm_session.session_strt_dte%TYPE,
    p_end_date IN pse_education_pgm_session.session_strt_dte%TYPE,
    p_coord_facility_join IN varchar2) return REP_DELIVERY_LOC_STAT_cur_Dyn;
    end REP_DELIVERY_LOC_STATISTICS;
    create or replace package body REP_DELIVERY_LOC_STATISTICS is
    FUNCTION REP_DELIVERY_LOC_STATISTICS(p_college_id IN pse_education_pgm_session.delivery_institution_id%TYPE,
    p_start_date IN pse_education_pgm_session.session_strt_dte%TYPE,
    p_end_date IN pse_education_pgm_session.session_strt_dte%TYPE,
    p_coord_facility_join varchar2) return REP_DELIVERY_LOC_STAT_cur_Dyn IS
    REP_DELIV_LOC_STAT_CUR_Dyn_Q REP_DELIVERY_LOC_STAT_cur_Dyn;
    BEGIN
    OPEN REP_DELIV_LOC_STAT_CUR_Dyn_Q FOR
    'SELECT distinct
    seps.coordinating_facility_id,
    peps.PSE_MUNICIPALITY_ID,
    seps.pse_education_pgm_session_id,
    cs.course_session_id
    FROM pse_education_pgm_session peps,
    sis_education_pgm_session seps,
    course_session cs,
    facility fac,
    desc_sis_reporting_area depa,
    desc_sis_reporting_type dept,
    pse_education_program pep
    WHERE peps.delivery_institution_id (+) = ' || p_college_id
    || ' and peps.session_strt_dte between ' ||p_start_date||' and ' || p_end_date
    || ' and seps.coordinating_facility_id = fac.facility_id (+)
    and seps.pse_education_pgm_session_id (+) = peps.pse_education_pgm_session_id
    and seps.pse_education_pgm_session_id = cs.pse_education_pgm_session_id (+)
    and pep.pse_education_program_id = peps.pse_education_program_id
    and dept.desc_sis_reporting_area_id = depa.desc_sis_reporting_area_id
    and pep.desc_sis_reporting_type_id = dept.desc_sis_reporting_type_id
    and dept.desc_sis_reporting_area_id = depa.desc_sis_reporting_area_id
    and fac.desc_facility_id in (2,3)' || NVL (p_coord_facility_join, '1=1');
    return REP_DELIV_LOC_STAT_CUR_Dyn_Q;
    END;
    end REP_DELIVERY_LOC_STATISTICS;

    I would sugest to grab a book like
    Inside Microsoft SQL Server 2008 T-SQL Querying (chapter 12 - Graphs, Trees, Hierarchies and Recursive Queries) or
    Joe Celko's Trees and Hierarchies in SQL for Smarties to get familiar with how model hierarchies using SQL.
    What is the meaning of the asterisks in the path?
    Here is a dirty example using the Adjacency List model.
    SET NOCOUNT ON;
    USE tempdb;
    GO
    CREATE TABLE dbo.T1 (
    id int NOT NULL UNIQUE CLUSTERED,
    name varchar(50),
    rootid int NULL
    INSERT INTO dbo.T1 (id,name,rootid)
    SELECT 1, 'animals', NULL
    UNION ALL
    SELECT 2, 'mamal', 1
    UNION ALL
    SELECT 3, 'cephalopod mollusc', 1
    UNION ALL
    SELECT 4, 'salt water fish', 1
    UNION ALL
    SELECT 5, 'fresh water fish', 1
    UNION ALL
    SELECT 6,'whale', 2
    UNION ALL
    SELECT 7,'pirana', 5
    UNION
    SELECT 8,'shark', 4
    UNION
    SELECT 9, 'octopus', 3;
    GO
    WITH Tree AS (
    SELECT
    id, name, rootid,
    CAST('/' + [name] + '/' AS varchar(900)) AS mat_path
    FROM
    dbo.T1
    WHERE
    rootid IS NULL
    UNION ALL
    SELECT
    C.id, C.name, C.rootid, CAST(P.mat_path + C.name + '/' AS varchar(900))
    FROM
    Tree AS P
    INNER JOIN
    dbo.T1 AS C
    ON P.id = C.rootid
    SELECT
    FROM
    Tree
    ORDER BY
    mat_path;
    GO
    DROP TABLE dbo.T1;
    GO
    Excuse my poor knowledge of zoology or animal biology.
    AMB
    Some guidelines for posting questions...
    AYÚDANOS A AYUDARTE, guía básica de consejos para formular preguntas

  • How to create an LOV based on a dynamic query

    Hi,
    Can someone tell me how to query a dynamic query for LOV. On my base page I have a dropdown-box (that will show the table names for searching) and is dynamically populated based on users access e.g. if user A logs in he may see 5 values (these values are basically table names) in a drop down if user B logs in he may see 10 values. I also have two input fields one field a user can enter value and the other field is read only and a torch icon for LOV so the user can search and select values that are populated in the input fields on the base page.
    How can I have my LOV that takes in a value selected in the dropdown and anyvalue entered in one of the input fields and search in the table selected in the dropdown box.
    Basically my LOV should do a search on the table and some search value passed when clicking on the torch icon. So a user can select any table-name in the drop down and my LOV should do a search only on the selected table. Once on the LOV Popup want to have a search field there but it only searched on the table selected in the dropdown on the based page. And the selected value on the LOV Popup page gets populated in fields on the base page.
    Any help is appreciated.
    Thanks

    Hi,
    I have created 4 SQL Based VO's with the following sqls
    SELECT header_id AS ID, to_char(order_number) AS NAME
      FROM oe_order_headers_all
    SELECT party_id AS ID, party_name AS NAME
      FROM hz_parties
    SELECT quote_header_id AS ID,
           (quote_number || CHR (45) || quote_version) AS NAME
      FROM aso_quote_headers
    SELECT sales_lead_id AS ID, to_char(lead_number) AS NAME
      FROM as_sales_leadsI created on LOVRegin and have the following 2 messagestyle items now what do I set in the ViewInstance and View Attribute fields
    srcid
    srcname
    Can you provide some sample code to set ViewUsage and whereclause that I need to put in the controller of LOVRegion.
    Thanks

  • Error In Adadmin Re-Create Grants And Synonyms For Apps Schema

    HI,
    I upgraded the my DB from 9.2.6 to 10.2.4.It was sucessfull.
    While doing Postupgradayion steps -
    Recreate grants and synonym for apps
    a. Log in to server with applmgr user
    b. Execute adadmin
    c. Choose -> Maintain Applications Database Entities menu
    d. Choose -> Re-create grants and synonyms for APPS schema
    2 workers got failed ...
    i chked the worker log file i found
    sqlplus -s APPS/***** @/stageAPP/stageappl/ad/11.5.0/admin/sql/adappsgs.pls &systempwd 1 PO APPLSYS APPS TRUE FALSE TRUE
    Connected.
    old 2: ad_apps_private.create_grants_and_synonyms(&2,'&3','&4','&5','FALSE');
    new 2: ad_apps_private.create_grants_and_synonyms(1,'PO','APPLSYS','APPS','FALSE');
    begin
    ERROR at line 1:
    ORA-20000: ORA-00955: name is already used by an existing
    object:create_grants_and_synonyms(1,PO,APPLSYS,APPS): create_base_gs(PO,APPS):
    In Synonyms
    Loop:create_synonym(PO,XXGOD_SEQ_DECORTIMESHEET_HDR,APPS,XXGOD_SEQ_DECORTIMESHEE
    T_HDR): do_apps_ddl(APPS,CREATE SYNONYM "XXGOD_SEQ_DECORTIMESHEET_HDR" FOR
    PO."XXGOD_SEQ_DECORTIMESHEET_HDR"):
    ORA-06512: at line 5
    Workaround $adctrl
    Control
    Worker Code Context Filename Status
    1 Run Grants/Synonyms R115 adappsgs.pls FAILED
    2 Run Grants/Synonyms R115 Wait
    3 Run Grants/Synonyms R115 Wait
    4 Run Grants/Synonyms R115 Wait
    5 Run Grants/Synonyms R115 Wait
    6 Run Grants/Synonyms R115 Wait
    7 Run Grants/Synonyms R115 Wait
    8 Run Grants/Synonyms R115 Wait
    9 Run Grants/Synonyms R115 Wait
    10 Run Grants/Synonyms R115 Wait
    11 Run Grants/Synonyms R115 Wait
    12 Run Grants/Synonyms R115 Wait
    13 Run Grants/Synonyms R115 Wait
    14 Run Grants/Synonyms R115 Wait
    15 Run Grants/Synonyms R115 Wait
    16 Run Grants/Synonyms R115 Wait
    SQL> select owner, object_type from dba_objects where object_name = 'XXGOD_SEQ_DECORTIMESHEET_HDR';
    OWNER OBJECT_TYPE
    PO SEQUENCE
    APPS SEQUENCE
    Its Cutom Object .. I think i need to drop/rename anyone .. which one i should drop / rename .
    Or
    Is it possible to skip the failed workers .. if do .. please give me the steps ...
    Thanks

    Hi;
    There is 8 option(hidden) avaliable but i suggest dont use this option.(As you mention its a custom,if you belive it wont problem you can use this hidden option or drop 'XXGOD_SEQ_DECORTIMESHEET_HDR' and recreate it later,its own your risk) By the way please check below notes which is similar error like yours
    Run Adadmin To Recreate Grants And Synonyms ORA-20000 ORA-00955 In Synonyms Loop:create_synonym(GL,PLAN_TABLE,APPS,PLAN_TABLE) [ID 437714.1]
    ADADMIN MAINTAINING APPLICATIONS GRANTS AND SYNONYMS APP-931 ORA-955 ORA-20000 [ID 1014455.102]
    Regard
    Helios

  • Help! Inaccessible iterator when using dynamic query

    Hi!
    I have a problem retreiving results from a dynamic query into sqlj iterator.
    I consulted the Oracle App Dev Guide and Oracle SQLJ Dev Guide and wrote the following code:
    <PRE>
    package pmServer;
    #sql iterator LocIterator (int id, String name);
    public class pmRISDImpl
    public int GetLocations(...)
    LocIterator locIt;
    String q = "select ID, NAME from PMADM.LOCATIONS";
    #sql
    BEGIN
    open :OUT locIt for :q;
    END;
    </PRE>
    When I try to compile it using tools provided by JDeveloper ver 3.2.2.(Build 915) for JDK 1.2.2 I get error for #sql statement:
    Inaccessible Java type for host item locIt (at position #1): pmServer.LocIterator
    and warning:
    Type pmServer.LocIterator of host item locIt (at position #1) is not permitted in JDBC. This will not be portable.
    Althow the code is identcal to those demonstrated in Oracle document "Oracle8 i
    SQLJ Developers Guide and Reference
    Release 3 (8.1.7)
    July 2000
    Part No. A83723-01" pp 12-67 (PL/SQL in SQLJ for Dynamic SQLDynamicDemo.sqlj). There it looks like
    <PRE>
    private static void dynamicSelectMany(String what_cond)
    throws SQLException {
    System.out.println("dynamic multi-row query on table emp");
    Employees empIter;
    // table/column names cannot be bind args in dynamic PL/SQL, so
    // build up query as Java string
    String query = "select ename, sal from emp " +
    (((what_cond == null) &#0124; &#0124; (what_cond.equals(""))) ? "" :
    (" where " + what_cond)) +
    "order by ename";
    #sql {
    begin
    open :OUT empIter for -- opening ref cursor with dynamic query
    :query;
    -- can have USING clause here if needed
    end;
    while (empIter.next()) {
    System.out.println("Employee " + empIter.ename() +
    " has salary " + empIter.sal() );
    empIter.close();
    </PRE>
    Please guide me what should I do to get it working.
    null

    In the CAST statement the SQLJ runtime must be able to produce an instance of you SQLJ iterator using Java reflection.
    This necessitates that the iterator class must be accessible by public.
    You have two options:
    (1) Declare the iterator public. This requires that you put it in its own file LocIterator.sqlj:
    #sql public iterator LocIterator (int id, String name);
    (2) Declare the iterator as an inner class. In this case you want to make it public static (that is it does not require an instance of the outer class in scope). You might write the following.
    package pmServer;
    public class pmRISDImpl
    #sql public static iterator LocIterator (int id, String name);
    (3) If you are using Oracle 9i you have another option. You can embed dynamic SQL fragments directly in your SQLJ code and do not need to use the CAST:
    public int GetLocations(...)
    LocIterator locIt;
    String q = "PMADM.LOCATIONS";
    #sql locIt = { select ID, NAME from :{q} }; // Note new syntax :{q} for embedding SQL source code
    }

  • Query a stored procedure that exec's a dynamic query. Error Linked server indicates object has no columns

    I have a stored procedure that dynamically creates a pivot query.  The procedure works and returns the correct data.  Now I have a requirement to show this data in reporting system that can only pull from a table or view.  Since you can not
    create a dynamic query in a view I tried to do a select from using openquery. 
    Example 'Select * from OpenQuery([MyServername], 'Exec Instance.Schema.StoredProcedure')
    I get the error back "the linked server indicates the object has no columns".  I assume this is because of the first select statement that is stuffing the variable with column names. 
    CODE FROM PROCEDURE
    Alter PROCEDURE [dbo].[Procedure1]
    AS
    BEGIN
    SET NOCOUNT ON
    Declare @cols nvarchar(2000),
      @Tcols nvarchar(2000),
      @Sql nvarchar (max)
    select @cols = stuff ((
          Select distinct '], ['+ModelName + '  ' + CombustorName
           from CombustorFuel cf
           join Model m on cf.modelid = m.modelid
           join Combustors cb on cf.CombustorID = cb.CombustorID
           where cf.CombustorID > 0
           for XML Path('')
          ),1,2,'')+']'
    Set @Tcols = replace(@Cols, ']', '] int')
    --Print @Tcols   
    --Print @Cols
    Set @Sql = 'Select GasLiquid, FuelType, '+ @Cols +'
    from
     Select GasLiquid, FuelType, ModelName+ ''  '' +CombustorName ModelCombustor, CombFuelStatus+''- ''+CombFuelNote CombFuelStatusNote
      from Frames f
      join Family fa on f.Frameid = fa.frameid
      join Model m on fa.FamilyID = m.FamilyID
      join CombustorFuel cf on m.Modelid = cf.modelid
      Join Combustors c on cf.CombustorId = c.CombustorID
      join FuelTypes ft on cf.FuelTypeID = ft.FuelTypeID
      where cf.CombustorFuelID > 0
        and CombustorName <> ''''
     ) up
    Pivot
     (max(CombFuelStatusNote) for ModelCombustor in ('+ @Cols +')) as pvt
    order by FuelType'
    exec (@Sql)

    Then again, a good reporting tool should be able to do dynamic pivot on its own, because dynamic pivoting is a presentation feature.
    SSRS Supports dynamic columns: Displaying Dynamic Columns in SSRS Report
    SQL Reporting Services with Dynamic Column Reports
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014
    Displaying and reading are two very different things.
    #1) SSRS Needs a fixed field list on the input side to know what what to make available in the designer.
    #2) SSRS cant read "exec (@Sql)" out of a proc, even if there is a fixed number of columns (at
    least it can't use it to auto build the field list from the proc)
    I use dynamic SQL in my report procs on a fairly regular basis and I've found it easiest to simply dump
    the results of my dynamic sql into a temp table at the end of the procs and then select from the temp table.
    Basically, Erland is correct. Stop trying to pivot in the query and let SSRS (or whatever reporting software you're using) handle it with a Martix.
    Jason Long

  • Building a dynamic query

    I have a need to build a truly dynamic query, that would be able to take online form input and create a query that would handle data requests like, How many employees earn less than #some salary, have a masters degree, and speak chinese.  or show me all the employees in org A that are vets.
    A true ad hoc query tool. 
    the back end is oracle 11g, the database  contains about 8 or 9 tables all total there about 500 records that will be searched. we are running CF7.
    I just started kicking this around today so I am open for Ideas.  add filters in the where clause, i got that,   start with  1=1 and use conditional statements to add filters as necessary.  setting up the Select and From statements, need help there.
    Since this is a small db, I thout about, but scrapped, making a super-view to query from.
    your thoughts and suggestions would be greatly appreciated.
    thanks
    jb

    What about something like this:
    1) Determine what tables are going to be involved (visual GUI/drag & drop interface for the users?)
    2) Have a table that defines the relationship between the other tables in your database - once the table selection is made by the user, you can query this table to determine what columns you are going to join on.  Obviously this won't allow you complete customization but it would work for the scenarios you describe.
    3) Use your database system properties to retrieve the field names from your included tables
    4) Allow your users to add "filters" based on the fields retrieved in (3)
    e.g. You could use an interface to allow users to add a filter, where you display a list of fields from your tables and allow them to apply a simple filter to them - keep it simple (=, !=, >, <)
    for bonus points, you could limit the options based on the field type (checkboxes for bit fields, etc)
    sanitize the user input - find a SQL-safe reg exp script to handle any unwanted characters (I'm looking at you apostrophe).
    5) Don't try an support aggregates if you don't need to - users can load the results into excel and manipulate them to their hearts content.
    6) Build your SQL using the selections made by the user.  Import all records from your joined tables.  Use the table from (2) to determine which fields they join on.  and build your where clause using the filters the user created in steap (4).  Again, be sure anything not explicitly set by the system is sanitized prior to making its way into the SQL.
    7) Execute() your SQL inside a CF query.  Expect pretty poor performance, since most SQL databases won't optimize a query plan from a dynamic SQL evaluation.
    You could build this as a multi-step wizard in CF, but it would be pretty flashy as a jQuery/web service based application.

  • Sort problem on dynamic query !!

    Hi,
    I have a dynamic query written in pl/sql, when I check "Sort" for each field in Report Attribute, error message raised up as "ORA-01785: ORDER BY item must be the number of a SELECT-list expression".
    If I do not check Sort, it works fine. In my apps I need all fields sorted by user, how to fix this problem?
    My query as below:
    declare
    query varchar2(2000):='select';
    s_class varchar2(1000);
    cursor c1 is select * from demo_preference;
    begin
    for c1_val in c1 loop
    if c1_val.login is not null then
    query := query ||' ' || 'login' || ',';
    end if;
    if c1_val.id is not null then
    query := query ||' ' || 'id' || ',';
    end if;
    end loop;
    query := SUBSTR(query, 1, length(query)-1);
    s_class := '(NVL(:P2_class, ''%'' || ''null%'') = ''%'' || ''null%'' OR
    EXISTS (SELECT 1 FROM apex_collections WHERE collection_name = ''P2CLASSCOL'' AND c001 = class))';
    query := query ||' ' || 'from ming.reg_report_view1 where'
    || ' ' || s_class;
    return(query);
    end;

    Maybe the internally mapped column used when you clicked on sort is not shown in the report. Try using aliases when you construct the query string, it could help apex internally in identifying a column even if its order changes for a different user. After all the column order in the code is dynamic and I guess even the no of columns displayed might vary both of which could make sorting on a column identified with a number, invalid.
    How about displaying the report query somewhere, so that you know what is the exact query being processed, it might give you better information about the problem.
    If the problem persists, then use a collection that is fetched those record using the same query string and change the report to refer the collection and then set column sorting on. This way apex would get confused on what columns are being sorted and it would just sort on a c001..c050 column as though it was a string(yes problems with number columns sorting when you do this).

  • How to drop a schema?

    Hi,
    I need to drop a schema un oracle.
    can you please provide query and your suggestions?
    Thanks
    Sathya

    SQL> create user muz identified by muz;
    User created.
    SQL> grant connect,resource to muz;
    Grant succeeded.
    SQL> conn muz/muz;
    Connected.
    SQL> create table test(a number);
    Table created.
    SQL> select * from tab;
    TNAME TABTYPE CLUSTERID
    TEST TABLE
    SQL> disc
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> conn system/oracle
    Connected.
    SQL> drop user muz cascade;
    User dropped.

  • Dropping sample schemas like scott,hr,bi  from Oracle 11g Database.

    Hi Friends,
    Do any one have the query to drop all the sample schemas from Oracle 11g Database.Any steps need to be
    performed to drop all the schemas.
    Best regards,

    Hi;
    Please see:
    drop all objects owned by schema
    drop all objects owned by schema
    Regard
    Helios

  • Apps schema

    consider the situation and clear my doubt
    in case if i perform the export of the apps schema (logical backup) and after performing the schema level export of the apps schema,iam dropping the apps schema.
    now i am creating the apps schema and restroing the contents of the apps schema from the dumpfile which i exported.
    now my question is ::::: whether the apps schema will have normal functionality (or) is there any things i have to do after restroing the apps schema by importing the objects of the dumpfile into the apps schema
    please clear my doubt considering the situation i said here

    Hi,
    now my question is ::::: whether the apps schema will have normal functionality (or) is there any things i have to do after restroing the apps schema by importing the objects of the dumpfile into the apps schemaPartial export/import is not support -- See this thread for similar discussion.
    Datapump Export/Import for Refreshing ERP test from production
    Datapump Export/Import for Refreshing  ERP test from production
    Regards,
    Hussein

Maybe you are looking for

  • Different PO layout for different users - issue

    Dear Experts I am facing following issue: in ME23N in the item detail tab 'Purchase Order History) I have two end-users who see different columns; user A can see columns like Amount (=value of GR) and Amount in LC (=value of GR in local currency) whi

  • Icons are gone in MyGtkMenu after gnome update

    Hello, the icons of MyGtkMenu disappeared after the gnome 2.28 update, does somebody have the same issue?

  • Interactive reporting studio

    Hi all, Where can I get the setup files for downloading Interactive reporting studio 9.3.1 for Windows 32 bit platform? Is that available in Oracle's Edelivery? Edited by: user12973893 on May 10, 2010 12:55 AM

  • Consolidation of Financial statement

    Dear All, Consolidation of Financial statement I would like to consolidate financial statement for the few company codes (5 company codes) and they are assigned to different companies in the same client. All have different fiscal year. And controllin

  • Problem after downgrade

    I downgraded my iphone 3g from version 4.2 because it was slowing the device too much. I downloaded a 3.1.3 version to downgrade. The downgrade went on successfully, but I am not able to purchase apps anymore as the buy, download buttons seem unreact