Prefixing sequence with schema name in generated sql on oracle

Hi,
We use kodo 3.4 with an oracle database in a J2EE environment.
When we put on the kodo tracing during on of our testcases we see statements being generated like :
select LOOPBAANPERIODESEQUENCE.NEXTVAL from DUAL
When we check the rest of the statements we see :
SELECT * FROM PC52290.EINDELOOPBAAN (EINDELOOPBAAN being a table)
Is there any way to make kodo generate the following statement ?
select PC52290.LOOPBAANPERIODESEQUENCE.NEXTVAL from DUAL
Our kodo.properties we use :
javax.jdo.PersistenceManagerFactoryClass=kodo.jdbc.runtime.JDBCPersistenceManagerFactory
javax.jdo.option.Optimistic=true
javax.jdo.option.RetainValues=true
javax.jdo.option.NontransactionalRead=true
kodo.jdbc.DBDictionary=kodo.jdbc.sql.OracleDictionary
kodo.jdbc.ForeignKeyConstraints=true
kodo.LicenseKey=<VALID_LICENSE_HERE>
kodo.Log=DefaultLevel=WARN,SQL=TRACE,Runtime=WARN,Configuration=WARN
kodo.jdbc.Schemas=PC52290
kodo.PersistentClasses= ...
An example of our mapping :
          <class name="LoopbaanPeriode">
               <extension vendor-name="kodo" key="jdbc-sequence-factory" value="native"/>
               <extension vendor-name="kodo" key="jdbc-sequence-name" value="LOOPBAANPERIODESEQUENCE"/>
<extension vendor-name="kodo" key="jdbc-class-ind-value" value="1"/>
<field name="beginDatum"           persistence-modifier="persistent" />
<field name="statuut" persistence-modifier="persistent" />
<field name="loopbaan"                     persistence-modifier="persistent"/>
</class>
regards,
David De Schepper.

Hi David,
When faced with a similar problem, I wrote my own subclass of DBDictionary
(in my case actually a subclass of OracleDictionary), and plugged it into
kodo using the kodo.jdbc.DBDictionary property. My class overrode the
following methods:
public String getFullName(Table, boolean);
public String getFullName(Index);
Then at runtime, these methods stuffed in the correct Schema name for
certain tables and indexes, based on values yoinked from some user
properties.
Not sure if this will help or not in your case.
Cheers!
.droo.
On 4/9/06 2:48 PM, in article [email protected], "David De
Schepper" <David De Schepper> wrote:
yes that works but that is not an option for us.
We have an oracle schema for each developer on our team and don't want to
hardcode it in our mapping file (for obvious reasons)
FYI : kodo 4.0.1 does it correctly (generates PC52290.LOOPBAANPERIODESEQUENCE)
but since i have problems doing the upgrade to kodo 4.0 (with as few code
changes as possible) i'm going to have to advice my company not to do the
upgrade.
(In case you are intersted or have some time :
http://forums.bea.com/bea/thread.jspa?forumID=500000029&threadID=600017073&mes
sageID=600041994#600041994)

Similar Messages

  • DatabaseProcedure with return type prefixed with schema name

    Hi (Paco)
    I have a question about the DatabaseProcedure class. We are using Oracle proxy users for our database connections.
    Everything is accessed via a database role that are granted to the logged on user. All our database objects, tables etc are protected with this database role.
    When I want to call a database function/procedure I need to add the schema name as a prefix to the custom database object that we uses for parameters/return types.
    So far so good. I can also define a parameter prefixed with schema name via the DatabaseProcedure.registerArrayType ...
    But when I try to define a function call that uses this parameter I get an error saying "Declaration is not valid".
    The problem is located to the PROCEDURE_DEFINITION regular pattern:
    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 with the schema name.
    Any good suggestions or workarounds?!
    I actually did change the pattern runtime via reflection to make it work - but I really don't like this solution in the long run!
    /Torben
    Edited by: Zonic on 2013-05-07 10:52

    Hi Torben,
    I think I have a workaround for the issue that might work for you. If you look at the source of <font face="courier">DatabaseProcedure.registerArrayType</font> you find that it actually calls <font face="courier">DatabaseProcedure.registerCustomParamType</font>.
    public static void registerArrayType(String name)
      registerCustomParamType(name, Types.ARRAY, Array.getORADataFactory(), name);
    }As a workaround you could replace your calls to <font face="courier">DatabaseProcedure.registerArrayType</font> with calls to <font face="courier">DatabaseProcedure.registerCustomParamType</font> 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.DOTSThis way you don't have to use the "illegal" name in the DatabaseProcedure definition.
    Regards,
    Paco van der Linden

  • Dynamic prefix of schema name in PL/SQL objects

    I have a requirement where schema name would be passed as a parameter to the procedure and I am supposed to write some DML statements on some of the fixed tables. The table names are common among any schemas, but then only the schema names change.
    This weird requirment is because, here they do not maintain same names for schemas on DEV,QA,UAT and PROD databases, and I can not change that. My thoughts are that it can be acheived only using Dynamic SQL. I want to know whether any alternate ways exist since this is going to be the case on various packages and procedures. For example I have a package with around 80 procedures in it which have couple of DML statements in it. Now they want to pass the schema name to main procedure and want the 80 procedures to perform the DML on the schema name passed :)
    So, should I change all the 80 procedures and make all the DML in it to Dynamic SQL (I am afraid I might end up doing that)? Please not that I can not change all the environments to same schema names (Not in my hands)
    Please suggest.

    You can make use of this inside you programs. We do this.
    You can prefix the value before the object names.
    When the procedure can run from same user who has privs on other schemas.
    Just set the current_schema to HR , SCOTT or others.
    You will not need to Pass Parameters for each procedure.
    Current User can be same as the procedure run from or owner of the procedure.
    SQL> SELECT sys_context('USERENV', 'CURRENT_SCHEMA') FROM dual;
    SYS_CONTEXT('USERENV','CURRENT_SCHEMA')
    SCOTT
    SQL> alter session set current_schema=hr;
    Session altered.
    SQL> SELECT sys_context('USERENV', 'CURRENT_SCHEMA') FROM dual;
    SYS_CONTEXT('USERENV','CURRENT_SCHEMA')
    HR
    SQL> alter session set current_schema=scott
    Session altered.
    SQL> SELECT sys_context('USERENV', 'CURRENT_SCHEMA') FROM dual;
    SYS_CONTEXT('USERENV','CURRENT_SCHEMA')
    SCOTTSS

  • SQL Developer 4.0 - Database Diff - turn off schema name in generated script

    SQL Developer 4 / RDBMS 11GR2
    I know SQL Developer 4 is EA, but maybe the question has the same answer in 3.3.  Also if 4.0 EA questions need to be asked in a different forum, please advise.
    I am new to SQL Developer and I admit to using brand Z (TOAD) for many, many years.
    (1) When using Database Diff, is there a setting to turn off the schema name that is displayed in the scripts that are generated?  I looked in PREFERENCES, but if it is there, I did not see it.
    (2) While I have found good resources on SQL Developer, is there a FAQ on Database DIff that answers a lot of these silly type questions?
    Thanks in advance

    On the first screen of the DIFF wizard there's a check box for 'Schema' - uncheck that.

  • Schema name added to SQL query after SQL Command

    Post Author: rickeb1
    CA Forum: Data Connectivity and SQL
    Hello,
    I am using Crystal Reports XI.  I have created a Crystal report in the usual manner using a set of tables from a given database schema. When I look at the SQL query that Crystal generates, there are no data schema qualifiers anywhere.
    Then I added an SQL Command object that I use as an additional table. Now when I look at the generated SQL query, the data schema name is added to the beginning of the original query as well as to the new SQL Comand code. It also creates an EXTERNAL JOIN which uses this hard-coded schema name (not exactly sure what an "external join" is).
    This hard-coding of the schema name is causing a problem when we try to migrate the report to a different environment. Is there some way to avoid having Crystal generate a query with the schema name imbedded in the query, or is there a way to remove it after it is generated?
    Thanks!

    Post Author: rickeb1
    CA Forum: Data Connectivity and SQL
    Actually, our problem may be related to this:
    http://boardreader.com/t/Crystal_XI_249231/The_Show_SQL_Query_SQL_command_changes_89667.html
    Any help greatly (and desparately) apapreciated!

  • Pbm with document name while generating URL for created document

    Hi Gurus,<br>
    <br>
    When we upload a document and generate the URL for that document, and then while we paste the same in the explorer window to access it, I was able to see the dialog asking me whether to save or open the document with the <B>actual document name</B>.<br>
    <br>
    But, when I create a document using the template which we uploaded in SOLAR_PROJECT_ADMIN, and then generate the URL for that document, and then when I paste it in the explorer window to access it, the dialog now asks me to save or open the document, but it is not with the name of the <b>actual document</b>, but with the name of the <b>template</b>. <br>e.g <b>Business_Blueprint_template</b>.<br>
    <br>
    Can anyone say why such a problem? and how to solve it.<br>
    <br>
    Useful answers will certainly be greatly appreciated.<br>
    <br>
    best regds,<br>
    Alagammai.<br>

    Hi Gerry,
    try content matrix it gives you free 25 GB and it keeps metadata
    http://www.metalogix.com/Products/Content-Matrix/Features.aspx
    Kind Regards, John Naguib Technical Consultant/Architect MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation

  • Alias with field name in MS SQL Server

    Is it possible that we can define alias for field name in MS SQL Server?
    For example:
    mytable : Id, Name, Value
    Could we define "AnotherName" for "Name" field that we can call it from sql
    SELECT anothername from mytable

    I don't know if you can "permanently" create an alias
    without a view or something like that but if you just
    want another name when you execute a select do this:
    Select name as another name from tableAt least in some databases the syntax for that can vary slightly. So the following might be needed....
    Select name as 'another name' from table

  • How to validate XML Digital Signature with XML DB (o PL/SQL) in Oracle 11g

    Hi,
    Do you know if there is possibility to validate XML Digital Signature using XML DB (or PL/SQL) in Oracle 11g?
    Let say I have CLOB/XMLType containing Digitally Signed XML, and I want to validate, that thsi is proper signature. I also have public key of signer (I could store it in CLOB or file or Oracle wallet).
    Is it possible to do?
    If there is need to install additional component - then which one?
    Regards,
    Paweł

    Hi,
    this is what i got from someone...
    but the links he gave are not opening up...
    u have to place a picture there and have to load the digital signatures as Jpegs on to the server to OA top
    and have to refer them in the XML for dynamically get the signature on the reports
    when u select the properties of the picture placed in the XML template,
    there will be one tab with "URL"... in that u have to give the path for that jpegs
    Pls refer the following documents for enabling digital signature on pdf documents.
    http://iasdocs.us.oracle.com/iasdl/bi_ee/doc/bi.1013/e12187/T421739T481159.htm#5013638    (refer section 'Adding or Designating a Field for Digital Signature'
    http://iasdocs.us.oracle.com/iasdl/bi_ee/doc/bi.1013/e12188/T421739T475591.htm#5013688
    (Implementing a Digital Signature
    Is the BI Publisher installed on your instance of version 10.1.3.4 or higher?
    Pls procure a digital signature as soon as possible. The process can take time. OR we could use any certificate that you already might have OR generate a certificate using Oracle Certificate Authority for demo.

  • Generate DDL with schema name prefix

    Hi All
    We are trying to generate DDL with the schema prefix on all statements.
    eg. CREATE schema_name.table_name
    Is it possible to do this with Designer 6i/9i or even 10g? I guess it might a server generator preference setting.
    Thanks
    Kathy

    Well dbms_metadata.get_ddl will generate the ddl script with username by default if you dont want you can try your own script. Check the sample function which create to fix that.
    Hope this helps.
    SRI>set long 1000000
    SRI>create or replace function aaa(nstr varchar2,nuser varchar2) return varchar2 is
    2 begin
    3 return replace(nstr,chr(34)||nuser||chr(34)||'.','');
    4 end;
    5 /
    function created
    SRI>select dbms_metadata.get_ddl('TABLE','DEPT') from dual
    DBMS_METADATA.GET_DDL('TABLE','DEPT')
    CREATE TABLE "SCOTT"."DEPT"
    ( "DEPTNO" NUMBER(2,0),
    "DNAME" VARCHAR2(14),
    "LOC" VARCHAR2(13)
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "TOOLS"
    SRI>select aaa(dbms_metadata.get_ddl('TABLE','DEPT'),'SCOTT') from dual;
    AAA(DBMS_METADATA.GET_DDL('TABLE','DEPT'),'SCOTT')
    CREATE TABLE "DEPT"
    ( "DEPTNO" NUMBER(2,0),
    "DNAME" VARCHAR2(14),
    "LOC" VARCHAR2(13)
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "TOOLS"
    -Sri

  • How to exclude schema name from exported files (PL SQL Developer)

    Dear all,
    Just one question: I am using PL SQL Developer. My goal is to export some data (as .sql and .dmp files) from one database and to import them into the another database (both databases have identical structure - test database and production, just different database names and names of schema. In order to make it possible, I need to exclude schema name from generated export file. I believe that it is possible to do it automatically by setting up parameters of PL SQL Developer. How?
    Thank you in advance,
    Kindest regards,
    Dragana

    In the meantime, I have found the answer on my previous question:
    Actually, the initial idea (how to exclude schema name from exported files) was wrong. No need for any intervention.
    Trick is: Schema name can be changed during the import of exported files (PL SQL Developer during import gives possibility: From User (old schema) To User (new schema) .
    Hope that this will be useful info for others.
    Dragana

  • Schema name and object name quoted together in MRU after v3 to v4 upgrade

    After upgrading from v3 to v4 an app has a system generated Multi Row Update function that is broken;
    PL/SQL : ORA-00972: identified is too long
    declare
      function x return varchar2
      is
      begin
        begin 
          for c1 in ( select "MY_SCHEMA.MY_SEQUENCE".nextval pk from dual ) loop
           return c1.pk;
          end loop;
        end;
        return null;
      end;
    begin
      dbms_output.put_line(x);
    end;Note the Schema Name and the Object Name have been quoted together!
    Is this a known issue and do you know of a fix?
    Many thanks in advance
    Craig

    Hi Craig,
    this problem is not known so far.
    I had a look at the code and that change has been made because of multi byte support for sequence names and because of security reasons.
    We try to avoid breaking changes in applications, but it looks like we haven't expected that developers are specifying sequence names prefixed by the schema name.
    Maybe the following workaround is feasible for you:
    1) Find all tabular form columns which are using a sequence with a schema prefix as primary key source
    select *
      from apex_application_page_rpt_cols
    where primary_key_column_source_type = 'S'
       and instr(primary_key_column_source, '.') > 0;2) Go to that tabular form column and remove the schema prefix
    3) If the sequence is really in a different schema than the parsing schema of your application, create a synonym for it.
    Hope that solves your problem.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Passing schema name at runtime in batch file

    I am having a batch file where i am prompting users to tell the schema name to which they wish to connect at runtime. I am calling one .sql fil within that batch file to execute where i need user to connect to the specific schema at runtime
    My batch file looks like as
    set serveroutput on;
    set linesize 500;
    set scan on;
    spool test_bat.log
    Accept a PROMPT 'Enter the schema name you wish to connect: '
    Accept a_pw PROMPT 'Enter the password?: ' HIDE
    Accept a_connstr PROMPT 'Enter the connect string : '
    conn &a/&a_pw@&a_connstr
    Now after getting connected to the specified schema i would like to call some .sql file within the batch file which seems to be as
    select count(*) from <schema entered above>.table_name
    I want to use the above schema name (a) to get data from the tables.
    Please let me know how to get this.
    Thanks

    user11200661 wrote:
    That's fine but still i want to prefix the schema name within the .sql file. My .sql should contain the name of that parameter only as i want to get that parameter replaced by the schema name at runtime. Some other users are using the same .sql file and they have access to that specific schema only. i want to make the .sql file more general so that it can be used by everyone without altering it every time.Sorry, your requirement no longer makes sense.
    If people have to access a specific schema because they need the script for general use, then you will have to hard code the schema name into it.
    If the script is to prompt for the schema name and connect to that schema and then use that schema name inside the called sql script, then people would not be able to use it generically, as it would be reliant upon the schema name being passed in.
    It sounds as if you're trying to write one generic thing that needs to do two different tasks.
    Just have two scripts and make life simple.

  • Schema Name Question

    Dear all,
    I am new to Oracle DB.
    Currently I face a problem:
    In the same database, I have create the 3 schema and have the following tables:
    Schema A: Table123
    Schema B: Table123
    Schema C: Table456
    And under the Schema C, when I select the table Table123,
    (Select * from Table123), I get the data from Schema A by default. How can I config my oracle such that I will get the result from the Table123 in schema B when executing (Select * from Table123), without specifing the schema name in the SQL ?

    This forum is for issues related to Oracle XML DB, not general questions. I suggest you try the General or SQL forum

  • ORA-06502 pl/sql in Oracle warehouse builder

    Hi,
    I have a problem with using Name and Address operator in Oracle Warehouse builder. When I mapped a table which has more than 7735 rows to another table.
    I will get the error "ORA-06502: PL/SQL: numeric or value error: character string buffer too small".
    How can I solve this problem?
    Thanks a lot!

    The problem is happening again.
    When it happens, if I quit and I start again Oracle XE, the problem does not happen at first, but happens again after a while (the duration before the error is not always the same). If I increase the number of lines that are printed for the result of a request, I can induce the error; if I decrease the number of lines, the error is not happening.
    Here is one of the request (that request returns about 5000 rows) that cause the error, and the complete error message:
    ORA-06502: PL/SQL : erreur numérique ou erreur sur une valeur: tampon de
    chaîne de caractères trop petit
    Translation: buffer for the strings is too small.
    select code_pers, nom, prenom, titre, sexe,
    date_naissance, pays_nationalite.code_pays_iso,
    fonction_institution, code_institution,
    complement_adresse_institution, complement_tel_institution,
    adresse1_perso_debut, adresse2_perso_rue, adresse3_perso_zip_ville,
    pays_adresse.code_pays_iso,
    tel_perso, email, site_web, fax,
    lower(substr(langue_courrier, 1, 2)),
    case
    when (adresse_courrier_preferee = 'P') then 'p'
    when (adresse_courrier_preferee = 'I') then 'i'
    else null
    end,
    contact_rapide, discipline,
    case
    when (voeux = 'Vrai') then 'o'
    when (voeux = 'Faux') then 'n'
    else null
    end,
    nb_plaquettes, nb_affiches, date_modif
    from personne2 join pays2 pays_nationalite
    on personne2.nationalite = pays_nationalite.NOM_PAYS
    join pays2 pays_adresse
    on personne2.pays_perso = pays_adresse.NOM_PAYS

  • How to make sure that schema name is not included with generated sqls

    How to make sure that schema name is not included with generated sqls with tableadapter wizard.
    What should I use? Oledb, ODT.NET, where can set that I want "pure" sqls, not schemas, not ", or anything like this
    I want
    "Select a,b from t1" ,not "select "a","b" from schema.t1"
    Also schema name is put in all parameters, all over the place... What if schema name changes. (b1test to b1prod)
    . I now manually edit XML files of dataset. It works but....
    thanks

    The full hardware :
    Processor Intel core due 3.00 MHz
    RAM:1.5GB
    psu:650 Watt (but i baught i cheap one so it may be actually about 400 watt)
    HD Disk:160 GB
    But about the power supply if it not able to run the VGA card ,Is it will not show any screen or it will not able to run the computer??

Maybe you are looking for