In this article I will show you how to view stored procedure/function definition using DataGrip tool.
In toolbar navigate to View -> Tool Windows -> Database or press Alt + 1 key combination.
Fig.1. Database in View menu
In opened explorer expand [your database], [your schema] and routines branch. Find interesting procedure/function, than right click on it and select SQL Scripts.
Fig. 2. SQL Scripts options
In SQL Scripts select one of the following:
- Source Editor - to open trigger code with all properties statements in editor
- SQL Generator… - to open SQL Generator window, which allows generate different types of SQL (e.g. routine definition)
Fig. 3. SQL Generator window and options
- Request and Copy Original DDL - to copy only routine DDL statement without additional statements (only
CREATE PROCEDURE
/CREATE FUNCTION
) - Generate DDL to Clipboard - to copy routine DDL statement with additional statements (like
exec sp_addextendedproperty
in SQL Server) - Generate DDL to Console - to open routine DDL statement with additional statements in database console