Oracle无限分级下查询指定分类下所有子分类Sql

表结构:

create table "KDCategory"  (
   "CategoryID"         INTEGER                         not null,
   "CategoryName"       VARCHAR2(30),
   "CategoryDesc"       VARCHAR2(1024),
   "ParentCategoryID"   INTEGER,
   "Deepth"             INTEGER,
   "Remark"             VARCHAR2(1024),
   "IDPath"             VARCHAR2(1024),
   "NamePath"           VARCHAR2(1024),
   "CategoryTag"        VARCHAR2(100),
   constraint PK_KDCATEGORY primary key ("CategoryID")
);


查询代码:

select * from Kdcategory connect by prior CategoryID=parentcategoryid start with CategoryID=2 order by categoryid 


 

你可能感兴趣的:(oracle,sql,table,null,Integer)