Tuesday, April 5, 2011

SQL Query to find all Records within a Specific Peoplesoft Component

I found this query on CompShack and wanted to also post on here.  I have used the following sample: 'ADM_APPL_MAINTNCE'

This query would be useful when you do a CNTL+J and are wanting to know the table names without going into App Designer.

SELECT DISTINCT (recname)
FROM psrecdefn
WHERE recname IN
(SELECT DISTINCT (recname)
FROM pspnlfield
WHERE pnlname IN
(SELECT DISTINCT (b.pnlname)
 FROM pspnlgroup a, pspnlfield b
WHERE (   a.pnlname = b.pnlname OR a.pnlname =b.subpnlname)
AND a.pnlgrpname = 'ADM_APPL_MAINTNCE' -- specify your component name)
AND recname <> ' ')
UNION
SELECT DISTINCT (recname)
FROM pspnlfield
WHERE pnlname IN
(SELECT DISTINCT (b.subpnlname)
 FROM pspnlgroup a,pspnlfield b
WHERE (a.pnlname = b.pnlname OR a.pnlname = b.subpnlname )
AND a.pnlgrpname = 'ADM_APPL_MAINTNCE') -- specify your component name)
AND recname <> ' ')
AND rectype in ('0')  -- specify record type, default is 0 for table
--AND rectype in ('0', '1', '2')  -- specify all types
ORDER BY recname ASC

3 comments:

Lepa said...

Jeromy,

Thanks for pointing out the source of the SQL. I'm the owner of compShack.com and appreciate it when people give credit where it belongs.

I follow your blog often and thank you again for your post.

Anonymous said...

Nice post

Tee Chess said...

I have used this code in my application and wanted to thank you for sharing this important piece of code that has helped me a lot. I really appreciate the hard work that you have put in making this blog post and also crediting the one who actually made this query.
oracle r12 documentation