Select the schema name. How?

Hi all

Can be a very simple question, how can I select the scheme name that I am connected. I don't wear DBA privileges.


-Sam
SELECT USER FROM DUAL

Tags: Database

Similar Questions

  • Select the schema dynamically

    Hello

    I would like to query a table of each scheme, same table exists in more than 20 patterns. So I dynamically select the schema and the result, the coil, but below

    statement is not to fetch all the records, can someone help me please?

    [code]

    Spoo result.txt

    Set serveroutput on

    declare

    cursor c1 is select master, table_name from all_tables where table_name = 'ALLOCATE_TBL '.

    order by owner, table_name;

    Start

    for rec in c1

    loop

    run immediately "select ALLOCATE_TYPE, ALLOCATE_SUBTYPE from". Rec.Owner |'. ' | Rec.table_name;

    end loop;

    end;

    /

    Spoo off

    [/ code]

    Hello

    Whenever you make dynamic SQL code, put all the dynamic instruction in a string variable and displays this string until run you it.  In this way, you can see exactly what it's done, and, if that fails, have a better idea why.  You can comment or remove the statement display under test is finished.  That's what I was doing in the code I posted before:

    -dbms_output.put_line (single_table_select |) "= single_table_select"); -for debugging

    I don't know what you're trying to do here, so I can't tell you how to do it.  This would help a lot if you could post instructions INSERT, CREATE TABLE and or something equivalent, and the desired output.  For example, "if I have the standard emp table in the scott schema, and I also have a table of emp 3 rows in my own scheme, like this."

    CREATE TABLE emp

    AS

    SELECT eanme. "JR" AS ename

    empno

    FROM scott.emp

    WHERE deptno = 10 - only 3 rows

    ;

    then the output should be... »

    You try to put the name of the owner of the table result set?

    How would you do that if you could hard-code the owner (SCOTT) and the name of the table (ALLOCATE_TBL')?  You would do something like that?

    SELECT 'SCOTT' as owner

    allocate_type

    allocate_subtype

    SCOTT. ALLOCATE_TBL

    ;

    ?  If you want to replace the parts in red with a dynamic text, you can concatenate variables instead of hardcoded text.  You already do that correctly for SCOTT and ALLOCATE_TBL on the last line; you just need to do the same thing for SCOTT on the first line.  And don't forget, when you want to have a sungle quote inside a string literal, use 2 single quotation mark in a row.  Maybe you want to do something like this:

    insert_statement: = "INSERT INTO coll_test (owner, allocate_type, allocate_subtype).

    || ' SELECT DISTINCT "'

    || Rec.Owner

    || ""', allocate_type, allocate_subtype FROM ".

    || Rec.Owner

    || '.'

    || Rec.table_name;

    Never answer my question

    ... Why do you have these similar tables in several patterns?   The fact that you need to interview all the ALLOCATE_TBLs at the same time suggests that logically they are all part of the same table.  Why not physically stored in the same table?

    All you want to do, I suspect that you are making it harder than it needs to be,

  • Select the column name when the value = something

    Is there a way to select the column name when there is a specific value in it?

    As follows:

    create table (abc123)

    COLUMN1 VARCHAR2 (50).

    COLUMN2 VARCHAR2 (50).

    Column3 varchar2 (50)

    );

    insert into abc123 values ('yes', 'Yes', 'No');

    insert into abc123 values ('no', 'Yes', 'No');

    INSERT INTO ABC123 VALUES ('no ',' no', 'No');

    insert into abc123 values ('yes', 'Yes', 'Yes');

    SELECT CASE WHEN COLUMN1 = 'Yes' THEN - the name of the column would be here somehow?

    WHEN COLUMN2 = 'Yes' THEN - the name of the column would be here somehow?

    WHERE Column3 = 'Yes' THEN - the name of the column would be here somehow?

    Another null

    finish as abc123 columnname

    final results for the just Column1 would be:

    COLUMN1

    NULL VALUE

    NULL VALUE

    COLUMN1

    I'm not sure what I use to get the name of column in there

    Thank you.

    Hello

    708631 wrote:

    Is there a way to select the column name when there is a specific value in it?

    As follows:

    create table (abc123)

    COLUMN1 VARCHAR2 (50).

    COLUMN2 VARCHAR2 (50).

    Column3 varchar2 (50)

    );

    insert into abc123 values ('yes', 'Yes', 'No');

    insert into abc123 values ('no', 'Yes', 'No');

    INSERT INTO ABC123 VALUES ('no ',' no', 'No');

    insert into abc123 values ('yes', 'Yes', 'Yes');

    SELECT CASE WHEN COLUMN1 = 'Yes' THEN - the name of the column would be here somehow?

    WHEN COLUMN2 = 'Yes' THEN - the name of the column would be here somehow?

    WHERE Column3 = 'Yes' THEN - the name of the column would be here somehow?

    Another null

    finish as abc123 columnname

    final results for the just Column1 would be:

    COLUMN1

    NULL VALUE

    NULL VALUE

    COLUMN1

    I'm not sure what I use to get the name of column in there

    Thank you.

    Thanks for posting the CREATE TABLE and INSERT for the sample data.

    Don't forget to post the exact results you want from these sample data.  If the results depend on the parameters you want to pass a run time, then give a few different examples, with the the desired results of each.

    You can hardcode the values you want, such as the column names in a query.  For example:

    SELECT CASE WHEN column1 = 'Yes' THEN 'Column1' END like y1

    CASE WHEN column2 = 'Yes' THEN 'Column2' END like y2

    CASE WHEN Column3 = 'Yes' THEN 'Column2' END like y3

    , a. *-If wanted

    Of abc123 one

    ;

  • Select the computer name of the machine running a WebForm (10g)

    Hello. I am looking for a way to select the computer name of the machine running a Web (10 g) form. Is this possible?

    I know I want the Windows environment variable access is: % ComputerName %

    Any suggestions?

    There is a Win_API_Environment packeg in WEBUTIL with a function called Get_Computer_Name, this should do the job.

    Alternative (also using WEBUTIL, but without the dll call):

    CLIENT_HOST('cmd /c set COMPUTERNAME > c:\temp\computername.txt');
    

    Then use CLIENT_TEXTIO to read the contents of the file.

    Published by: Andreas Weiden on 14.01.2009 18:56

  • 4.1 ai2 Migration for SQL Server: cannot change the schema name?

    I'm trying to convert a SQL Server database to Oracle.

    As I wanted to insert into an existing (with not the same name on SQL Server) schema, I followed this guideline:

    A SQL Developer... @dermotoneill: migrate existing users of Oracle

    I first picked up the source and then tried to convert the designation.

    but there is no tab:

    Migrate_missing_naming.jpg

    (you can see it's really show the previously entered data as I can choose the check box 'Show only data types used in the source model')

    Is there a new path now how to map the schema?

    Thank you

    Martin

    Hi Martin,

    This page of naming of the object has been removed from the migration wizard.

    The feature is now available in the migration of object report.

    It's easier to work with the report that you can filter and order objects according to your needs.

    In this case, you can simply show the OBJECT_TYPE = 'SCHEMA '.

    The steps are so.

    (1) capture and convert you data source

    (2) open the report of the object (left click on the node "Convert database objects") and change the SCHEMA TARGET_OBJECT_NAME objects in your name of the desired target. Commit the changes.

    Translate 3) and generate the Oracle database (right-click on the node "Convert database objects")

    Kind regards

    Dermot.

    SQL development team.

  • Need info of table based on the schema name

    I need the following information for a given schema name:

    1. Table
      name
    2. Schema
      name
    3. Number or rows for each table (column catalogs num_rows)
    4. Size of the table (MB)

    I tried the query nelow but I can't make it work.

    Select col.table_name,
    Col.col_cnt as column_count,
    RC.row_cnt as row_count.
    s.size_in_MB as table_size_in_MB
    Of
    (
    / * number of columns * /.
    SELECT upper (table_name), COUNT (*) col_cnt
    FROM dba_tab_columns
    Owner WHERE = 'V500.
    Upper group (table_name)
    ) col

    Join

    (
    / * number of rows * /.
    Select
    table_name,
    TO_NUMBER (extractvalue (xmltype (dbms_xmlgen.getxml ("select count (*) c to ' |")))) ((table_name)), ' / LINES/LINES/C ')) as row_cnt
    from dba_tables
    where (iot_type! = 'IOT_OVERFLOW' or iot_type is null)
    and owner = 'SCOTT '.
    ) rc
    We upper (col.table_name) = upper (rc.table_name)


    Join

    (
    / * the size in MB of table * /.
    SELECT
    owner, table_name, (sum (bytes) / 1024/1024) size_in_MB
    Of
    (SELECT table_name, nom_segment, owner, bytes)
    FROM dba_segments
    WHERE segment_type = 'TABLE '.
    and owner = 'SCOTT '.
    )


    Group by owner, table_name

    ) s
    We upper (col.table_name) = upper (s.table_name);

    Paul








    I think you need this query:

    Select T.table_name,

    -to_number (extractvalue (xmltype (dbms_xmlgen.getxml ("select count (*) BSB_GL c.' |")))) ((table_name)), ' / LINES/LINES/C ')) as row_cnt

    Row_cnt T.Num_Rows,

    County (tc. Column_name) column_count;

    (sum (s.bytes) / 1024 / 1024) size_in_MB

    from dba_tables T


    Join the tc dba_tab_columns

    on tc. OWNER = "BSB_GL."

    and tc. Table_name = t.table_name


    Join dba_segments s

    on s.segment_name = t.table_name

    and s.OWNER = 'BSB_GL. '


    where (t.iot_type! = 'IOT_OVERFLOW' or t.iot_type is null)

    and t.owner = 'BSB_GL. '

    T.table_name group, T.NUM_ROWS

    If you gather stats column NUM_ROWS in dba_tables gives you cumber of rows in table correctly. And this will be faster than yous query

    ----

    Ramin Hashimzade

  • I changed somehow all my files with the same name, how the other way around how they had before

    I tried moving a file in My Documents to a new subfolder, but somehow ended up changing all my documents and files to the same name.  How can I reverse this back to how it was at the beginning?

    ALT + type EU or Ctrl + Z is the last Undo action.

  • DatabaseProcedure with the return type preceded of the schema name

    Salvation (Paco)

    I have a question on the DatabaseProcedure class. We use proxy Oracle users to our database connections.
    Everything is accessible via a role of database that are granted to the user. All of our database objects, tables, etc. are protected by this database role.
    When I want to call a function/procedure of database, I need to add the name of the schema as a prefix to the custom database object that uses us for parameters and return types.

    So far so good. I can also define a parameter prefixed by the name of schema via the DatabaseProcedure.registerArrayType...
    But when I try to set a function call that uses this parameter I get an error saying "the statement is not valid.
    The problem is the regular pattern of PROCEDURE_DEFINITION:
    private static final Pattern PROCEDURE_DEFINITION = Pattern.compile("\\s* (FUNCTION|PROCEDURE) \\s+ ([\\w.$]+) \\s* (?:\\((.*?)\\))? \\s* (?:RETURN\\s+(\\w+))? \\s* ;? \\s*", CASE_INSENSITIVE | COMMENTS | DOTALL);
    The return type cannot be prefixed by the name of schema.

    Any good suggestions or workarounds?

    I have actually change the duration of reflection model to make it work-, but I really don't like this solution over the long term.

    / Torben

    Published by: Zonic 2013-05-07 10:52

    Hi Torben,

    I think that I have a work around for the problem which might work for you. If you look at the source of DatabaseProcedure.registerArrayType you will find that it is actually called DatabaseProcedure.registerCustomParamType.

    public static void registerArrayType(String name)
    {
      registerCustomParamType(name, Types.ARRAY, Array.getORADataFactory(), name);
    }
    

    A solution you can replace calls to DatabaseProcedure.registerArrayType with calls to DatabaseProcedure.registerCustomParamType as follows.

    // Instead of DatabaseProcedure.registerArrayType("NAME.WITH.DOTS") call:
    DatabaseProcedure.registerCustomParamType("anyNameWithoutDots", Types.ARRAY, Array.getORADataFactory(), "NAME.WITH.DOTS"); // Don't forget to use uppercase here.
    
    DatabaseProcedure dp = DatabaseProcedure.define("procedure my.procedure(param1 in out anyNameWithoutDots)");
    
    DatabaseProcedure.ParamType type = dp.getParamDef(0).getType();
    System.out.println(type.getName() + " is " + type.getTypeName()); // ANYNAMEWITHOUTDOTS is NAME.WITH.DOTS
    

    In this way, that you don't have to use the 'illegal' name in the definition of DatabaseProcedure.

    Kind regards
    Paco van der Linden

  • Select the customer name in a menu drop-down select or be able to type in

    Hello

    Is there a way to allow my users to have an option to select a customer name in a menu drop-down select or be able to kick it...

    Thanks in advance

    Hello

    I don't know about build Apex point of AutoComplete.
    But if you use jQuery UI to create the AutoComplete for the text element, you must limit not list user see all values.

    Kind regards
    Jari

  • Windows 8 store listing Multiple PCs with the same name - how to remove?

    Hi there... when I go to the store in Windows 8, in my account settings, I see four listed computers.  Two of them are named similarly (I reinstalled Windows 8 a few weeks after I had first and kept my the same PC name).

    I would like to remove one of the PC that has a duplicate name, but I don't know that one to remove.  Y at - it an easy way to see what is the PC I'm on right now, and what is the old PC?  I'm paranoid that to remove that incorrect it will cause my apps on this PC to stop working.

    Thank you!

    In fact, I just understand how do.  Here's what worked for me:

    • Rename your computer from the desktop.  Right click on my computer > properties > etc.
    • You will need to reboot for the change to take effect.
    • Now, go to the Windows store and download an application.  Any application.  It may be a free, or one that you have already purchased.  Is not serious.
    • Once the download is complete, you can return to your account in Store, and you'll see your list of computers is updated with your newly renamed computer.
    • You can now delete the duplicate computer registration.
    • Once it is removed, follow the steps above to rename your computer in its original name.

    It seems that you must actively download an app from the store in order to force it to update the list of the PCs in your bank account settings.

  • Select the layer name

    I need to select a specific layer or group by name.  What is the correct syntax to do this with Javascript?

    you want to select all the items on the layer? or only some types (e.g., blocks of text, groups, paths)?

    Let's take a look at the same time.

    Let's start by selecting all the elements on a given layer (in this case the layer is called "Target layer");

    Note that pageItems means that any element of art in the document. could be text, could be a path, can be a group, could be a compound path.

    var docRef = app.activeDocument;
    var layers = docRef.layers;
    var myLayer = layers["Target Layer"]; //this defines the layer that you want to get the selection from
    
    docRef.selection = null; //ensure there is nothing in the document selected already. this way you only get the selection you want.
    for(var a=0;a
    

    now lets do the same thing, but we will choose just the groupItems

    var docRef = app.activeDocument;
    var layers = docRef.layers;
    var myLayer = layers["Target Layer"];
    
    docRef.selection = null;
    for(var a=0;a
    

    and finally, in order to be comprehensive, allows to select two different types of art objects, but not all types. For example, if a single layer has text blocks, groups, paths and transparent traces. Let's just select managers of related texts and groupItems. This time we will have to include a conditional statement to find the correct item types.

    var docRef = app.activeDocument;
    var layers = docRef.layers;
    var myLayer = layers["Target Layer"];
    
    docRef.selection = null;
    for(var a=0;a		   
  • increment the variable names - how can I do? Google Maps API

    I am trying to integrate google maps into my website. I want the user to be able to view the current customers of my company.

    Can I query my database and get name, longitude and latitude of the customer.

    I can do only one marker on the map like this:

    var marker = new GMarker (new GLatLng (< cfoutput > #geoip.testilat # < /cfoutput >, < cfoutput > #geoip.testilong # < /cfoutput >));
    GEvent.addListener (marker, "click", function() {}
    var html = ' < div style = "width: 210px;" padding-right: 10px "> < cfoutput > #geoip.schoolName # < / cfoutput > < br > < cfoutput > #geoip.text # < / cfoutput > < \/div > ';"
    marker.openInfoWindowHtml (html);

    });

    map.addOverlay (marker);

    GEvent.trigger (marker, "click");

    But I need to browse the database and create a marker for each line with a different variable for each name, IE. marker, marker1, etc...

    I know that I have to build some kind of loop, but I don't know how. Can someone point me in the right direction?

    Thank you

    currentRow is created by the closure of over a Recordset created by a

    I imagine that in your code example geoip was a record set from a query.  If this isn't the case, you can use any variable for which is convenient for your logic.

  • Name of the schema in the DB adapter

    Hello

    Schema name is hardcoded in the adpater DB, even if I do not select the schema name everything in creation.

    < jca:operation
    SchemaName = "APPS".
    PackageName = 'XX_PKG. '
    Procedurename = "POPULATE_DATA."
    InteractionSpec = "oracle.tip.adapter.db.DBStoredProcedureInteractionSpec" > "

    ...


    How can I make generic? Can I remove the SchemaName settings?

    My JNDI Url may change dynamically and the target database may have different schemas.


    Thank you
    Rishi

    SchemaName is an optional parameter.
    You can delete it.

    Prasanna-

  • How to get schema name and assign it to a column in the table target

    Hi team,

    I am getting the error while getting the schema name that you assign to a column target

    Implementation of the column:

    < % = odiRef.getSchemaName ("W") % >

    ERROR:

    ===========

    ODI-1217: Session TEMP (342001) fails with return code 904.

    ODI-1226: step TEMP fails after 1 attempt.

    ODI-1240: Flow TEMP fails during an operation of integration. This flow of charge target TEMP table.

    ODI-1228: failure of the TEMP (integration) task on the target of ORACLE ORACLE_MSR_SRC connection.

    Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "USERINROW": invalid identifier

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)

    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)

    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)

    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)

    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)

    =============

    Implementation of the column:

    < % = odiRef.getSchemaName ("ORACLE_MSR_SRC", "DEVELOPMENT", "W") % >

    com.sunopsis.tools.core.exception.SnpsSimpleMessageException: ODI-17517: error in the interpretation of the task.

    Task: 4

    java.lang.Exception: the application script threw an exception: com.sunopsis.tools.core.exception.SnpsSimpleMessageException: Exception getSchemaName ("ORACLE_MSR_SRC", "DEVELOPMENT", "W"): SnpLSchema.getLSchemaByName (): SnpLschema is no information OSB: insert new lines to the line: column 0: columnNo

    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:489)

    at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:737)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:465)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:366)

    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)

    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:292)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:855)

    Plz help me how can I get the user name ie... diagram for this target and the insertion in the table.

    Thanks in advance... Suggestions or advice much appreciated.

    Kind regards

    Khaled

    Use the Subtstitution method getInfo() Odi

    <%=odiRef.getInfo("pPropertyName")%>

    pPropertyName can be

    SRC_SCHEMA name of the schema of the data in the source environment
    SRC_WORK_SCHEMA name of the schema in the environment of the source
    DEST_SCHEMA name of the schema of data in environment target
    DEST_WORK_SCHEMA name of the schema in the environment target

    Kind regards

    Samir Bishwamilan

  • Schema name is missing from the DDL

    I use Oracle SQL Developer Data Modeler Version 4.0.2.840, the RDBMS type is SQL Server 2008

    the schema names are not in the CREATE TABLE or ALTER TABLE.

    I have suggested that I add the name of the schema in a physical model and then generate.

    I added the schema in the relational and physical models, but still no name schema.

    See the screenshot. Someone knows how to fix this? Thank you

    schema.jpg

    Hello

    You must check the 'Include Schema in DDL' setting ' tools > Preferences > Data Modeler > DDL.

    Philippe

Maybe you are looking for