使Oracle限制大于30 [英] Make Oracle limit larger than 30

查看:78
本文介绍了使Oracle限制大于30的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都知道Oracle的对象名称表名称列和bla-bla限制为30个字节,我一直在网上搜索了一个小时的解决方案,但找不到任何东西,最终我放弃了.

We all know that Oracle has limit of 30 bytes for object names table names columns and bla-bla, I have been searching the net for hours for a solution but I couldn't find anything and eventually I gave up.

我们正在开发一个同时使用MySQL和Oracle的应用程序,在开始实施Oracle之前,一切工作都很好,我们遇到了有关表和存储过程名称的问题.

We are developing an application that uses both MySQL and Oracle, everything was working fine until we starting implementing Oracle, we encountered problems regarding to the table and stored procedures names.

我无法更改表的名称,因为该应用程序已在客户端服务器上运行.

I can't change the names of the tables because the application is already running on client servers.

有解决方案吗?也许有些属性告诉oracle将限制设置为大于30.

Any solution? Maybe some property to tell oracle to make the limit larger than 30.

推荐答案

SQL转换器配置文件在Oracle 12c中可以帮助应用程序假装Oracle支持适当长度的对象名称.这样可以使您无需修改​​应用程序即可更改数据库.

SQL Translator Profiles in Oracle 12c may help the application pretend that Oracle supports object names of a decent length. This could allow you to change the database without modifying the application.

以下是将大于30字节的名称转换为短名称的简单示例:

Below is a trivial example of translating a greater-than-30-byte name into a short name:

SQL> create table short_table_name(a varchar2(100));

Table created.

SQL> insert into short_table_name values ('Success');

1 row created.

SQL> begin
  2     dbms_sql_translator.create_profile('LONG_OBJECT_NAMES');
  3     dbms_sql_translator.register_sql_translation(
  4             profile_name    => 'LONG_OBJECT_NAMES',
  5             sql_text        => 'select * from because_30_bytes_just_isnt_enough_sometimes',
  6             translated_text => 'select * from short_table_name');
  7  end;
  8  /

PL/SQL procedure successfully completed.

SQL> alter session set sql_translation_profile = LONG_OBJECT_NAMES;

Session altered.

SQL> alter session set events = '10601 trace name context forever, level 32';

Session altered.

SQL> select * from because_30_bytes_just_isnt_enough_sometimes;

A
----------------------------------------------------------------------------------------------------
Success

可能有效,但我可以想到十二个为什么这是一个坏主意的原因.仅将此作为最后的选择.

This may work but I can think of a dozen reasons why it is a bad idea. Only consider this as a last resort.

这篇关于使Oracle限制大于30的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆