PL/SQL (MOSC)

MOSC Banner

How to write a stored procedure using inner join

edited Feb 12, 2018 5:01AM in PL/SQL (MOSC) 4 commentsAnswered

Hello, how can I translate this sql query into a stored procedure and be able to get the report in this example?

spool cj.txt
set embedded on
                set echo off
                set trimspool on
                set linesize 200
                set feedback off
                set pagesize 0
                set colsep ','
                set headsep off

SELECT
                        a.agentname||','||a.lastconnectiontime||','||aecs.agentstatus||','||a.version||','||m.monitorname||','||aecs.categorystatusname
                FROM
                        protect.agentevent ae, protect.agenteventcategorystatus aecs, protect.agent a
                INNER JOIN
                        protect.informationmonitor m
                ON
                        a.aggregatorid = m.informationmonitorid
                WHERE
                        a.agentid=ae.agentid AND ae.categorystatusid=aecs.categorystatusid AND ae.eventdate=(SELECT max(eventdate) from protect.agentevent ae WHERE ae.agentid=a.agentid)

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center