Oracle SQL Developer SQL 选项卡为空

发布于 2024-09-28 07:57:43 字数 157 浏览 6 评论 0原文

我搜索了 SQL Developer 上的所有回复,但没有找到与此问题匹配的回复。我需要能够通过单击 sql 选项卡来查看表/视图等的 SQL,但现在它只显示一个空白屏幕。还有其他人解决了这个问题吗?它在蟾蜍中运行良好,我可以看到代码,但我们有一个新服务器,我无法使用蟾蜍连接到它。任何帮助都会很好。

I've searched through all of the responses on SQL Developer and I haven't found a response that matches this question. I need to be able to see the SQL for a table/view etc by clicking on the sql tab, but for now it simply shows me a blank screen. Has anyone else solved this? It works fine in toad and I can see the code but we have a new server and I can't connect to it with toad. Any help would be nice.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你与昨日 2024-10-05 07:57:43

它是空白的,因为用于获取视图背后的 SQL 的查询需要您的帐户缺乏的数据库权限。

DBMS_METADATA 是一个非常强大的包,只要现有对象需要 DDL,数据库就会使用它。 SQL Developer 将其用于 GUI 中的许多功能,包括此“SQL”页面。

select DBMS_METADATA.GET_DDL(
   'VIEW'
 , :NAME
 , :OWNER
)
  from dual
union all
select dbms_metadata.GET_DDL(
   'TRIGGER'
 , trigger_name
 , owner
)
  from Dba_triggers
 where table_owner = :OWNER
   and table_name = :NAME
union all
select dbms_metadata.GET_DEPENDENT_DDL(
   'COMMENT'
 , TABLE_NAME
 , OWNER
)
  from (
   select table_name
        , owner
     from Dba_col_comments
    where owner = :OWNER
      and table_name = :NAME
      and comments is not null
   union
   select table_name
        , owner
     from sys.Dba_TAB_comments
    where owner = :OWNER
      and table_name = :NAME
      and comments is not null
)

当此查询失败时,屏幕保持空白。

如果您只想获取视图后面的 SQL SELECT 语句,请参阅“详细信息”页面并检查 TEXT 和 TEXT_VC 列。

如果您需要 SQL 面板工作,请要求 DBA 授予您更高的字典权限,或者考虑:

  1. 为您的生产模式发布 HTML 数据模型,以便需要信息的人可以获取它,而不必使用数据库它本身
  2. 将应用程序中的源代码保存在源代码控制存储库中,以便需要信息的人可以获取它,而不必使用数据库本身

在此处输入图像描述

It's blank because the query used to obtain the SQL behind the view requires database privileges that your account lacks.

DBMS_METADATA is a very powerful package used by the database whenever DDL for an an existing object is required. SQL Developer uses this for many features in the GUI, including this 'SQL' page.

select DBMS_METADATA.GET_DDL(
   'VIEW'
 , :NAME
 , :OWNER
)
  from dual
union all
select dbms_metadata.GET_DDL(
   'TRIGGER'
 , trigger_name
 , owner
)
  from Dba_triggers
 where table_owner = :OWNER
   and table_name = :NAME
union all
select dbms_metadata.GET_DEPENDENT_DDL(
   'COMMENT'
 , TABLE_NAME
 , OWNER
)
  from (
   select table_name
        , owner
     from Dba_col_comments
    where owner = :OWNER
      and table_name = :NAME
      and comments is not null
   union
   select table_name
        , owner
     from sys.Dba_TAB_comments
    where owner = :OWNER
      and table_name = :NAME
      and comments is not null
)

When this query fails, the screen remains blank.

If you merely want to grab the SQL SELECT statement behind the view, see the "Details" page and inspect the TEXT and TEXT_VC columns.

If you need the SQL panel to work, ask your DBAs to grant you higher dictionary privs, or consider:

  1. publishing HTML data models for your production schemas, so that folks that need the information can grab it, w/o having to use the database itself
  2. keeping the source code in your apps in Source Control repos, so that folks that need the information can grab it, w/o having to use the database itself

enter image description here

尬尬 2024-10-05 07:57:43

当我连接到 SQL Developer 并输入 alter the session set current_schema=xyz 时,我将像该用户一样进行连接。
当我打开分支其他用户,导航到用户 xyz 的表,然后单击表 A_TABLE 时,我会在“列”选项卡中看到该表的定义,并且我还有其他几个选项卡,例如用于显示数据的数据桌子。到目前为止,一切都很好。
但是,当我导航到 SQL 选项卡(位于选项卡的最右侧)时,我希望看到表的 DLL,但该选项卡保持为空。 (这也发布在另一个线程中,但没有好的解决方案)

有没有办法让它工作?
后端的选项卡可能会在 user_tables 和 user_tab_columns 中查找以生成 DLL。
由于我进行了更改会话,该表可能位于 all_tables 视图中。

当我登录并单击我自己的表(但不是其他用户的表)时,它工作正常。
同样的想法也适用于视图定义。
另外,右键单击该对象并选择快速 DLL 会导致剪贴板的空文件/工作表。

简而言之,选项卡 SQL 只能对 dba 的模式所有者起作用吗?还是在使用 alter session set current_schema = xyz 时也可以起作用?

When i connect to SQL Developer and type alter the session set current_schema=xyz then i am connect as if i was that user.
When i open the branche other users, and navigate to a table of user xyz, and click table A_TABLE, then i see the definition of that table in the columns tab and i have several other tabs, such as data to show the data in the table. So far so good.
But when i navigate to the SQL tab (on the far right of the tabs) i would expect to see the DLL of the table, but this tab stays empty. (this is also posted in another thread, but no good solution)

Is there a way to get this working ?
Probably tab in the backend looks in user_tables and user_tab_columns to generatie the DLL.
And since i did an alter session, the table are probably in the all_tables view.

It works fine when i log in and click my own tables, but not that of other users.
Same think with view definitions.
Also right clicking on the object and choose quick DLL results in empty file/worksheet of clipboard.

In short, can the tab SQL only work for schema owners of dba's or can it also work when using alter session set current_schema = xyz

情绪 2024-10-05 07:57:43

不确定你的意思,但是:
1.你能使用Sqldev连接到你的数据库吗?您可以展开模式对象列表并查看您的表吗?
2. 如果是这样,那么当您打开 sql 工作表时,是的,它是空白的。这是您键入 sql 语句并执行它的地方。首先键入 FROM 子句,然后返回并添加 select 子句,sql dev 将显示表的列下拉列表,您可以从中选择而无需键入列名称。
3. 如果您想查看表格数据,只需双击左侧树形浏览器中的表格即可。
您还可以通过拖放以图形方式构建查询。
但是,SQL 工作表窗口的正常行为是显示空白,因此不确定您到底期望发生什么。

如果选择一个视图并右键单击并选择“导出 DDL”并选择“保存到工作表”,则 DDL 将粘贴到工作表中: 示例:
创建表“HR”。“国家”
( "COUNTRY_ID" CHAR(2 BYTE) CONSTRAINT "COUNTRY_ID_NN" NOT NULL ENABLE,
“COUNTRY_NAME”VARCHAR2(40 字节),
“REGION_ID”号,
约束“COUNTRY_C_ID_PK”主键(“COUNTRY_ID”)启用,
约束“COUNTR_REG_FK”外键(“REGION_ID”)
引用“HR”。“REGIONS”(“REGION_ID”)启用
) 组织索引 NOCOMPRESS PCTFREE 10 INITRANS 2 MAXTRANS 255 日志记录
存储(初始 65536 下一步 1048576 最小扩展 1 最大扩展 2147483645
PCTINCREASE 0 个 FREELISTS 1 个 FREELIST 组 1 个 BUFFER_POOL 默认值)
表空间“用户”
PCT 阈值 50;

SQL DDL 语句显示创建模式对象的“代码”。

Not sure exactly what you mean, but:
1. Can you connect to your db using Sqldev? Can you expand the list of schema objects and see your tables?
2. If so then when you open a sql worksheet, yes it is blank., this is where you type your sql statement and execute it. Type the FROM clause first, then go back and add the select clause and sql dev will show a drop down list of columns for the tables you can select from w/o typing the col names.
3. If you want to see you table data, simply double click the table in the tree browser on the left.
You can also build queries graphically though drag and drop.
But, normal behavior of the SQL worksheet window is to display blank, so not sure exactly what you expecting to happen.

If you select a view and right click and select Export DDL and Select Save to Worksheet, then the DDL is pasted into a worksheet: Example:
CREATE TABLE "HR"."COUNTRIES"
( "COUNTRY_ID" CHAR(2 BYTE) CONSTRAINT "COUNTRY_ID_NN" NOT NULL ENABLE,
"COUNTRY_NAME" VARCHAR2(40 BYTE),
"REGION_ID" NUMBER,
CONSTRAINT "COUNTRY_C_ID_PK" PRIMARY KEY ("COUNTRY_ID") ENABLE,
CONSTRAINT "COUNTR_REG_FK" FOREIGN KEY ("REGION_ID")
REFERENCES "HR"."REGIONS" ("REGION_ID") ENABLE
) ORGANIZATION INDEX NOCOMPRESS PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
PCTTHRESHOLD 50;

SQL DDL statements show the 'code' to create the schema object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文