Get sid from os pid - oracle database script

Get sid from os pid - Oracle Database Script.

- GET sid
FROM os pid (server process) col sid format 999999 col username format a20 col osuser format a15
SELECT b.spid,
       a.sid,
       a.serial#,a.username,
                 a.osuser
FROM v$session a,
     v$process b
WHERE a.paddr= b.addr
  AND b.spid='&spid'
ORDER BY b.spid;