Question

I have some PL/SQL stored packages which get deployed by different teams on different servers. Its always a hassle if i have to check if the same version is deployed across all the servers.

What I want to do is to create a function in the given package that calling it will print the current version of the file.

Now the version of the file that I want to get printed is the version which is in P4. So What i am looking at that once I submit the file into perforce, perforce automatically update a certain variable with-in the file which corresponds to the current submitted version and in plsql, I can just print it.

How can I do this ?


Thanks to @cristobalito for referring to P4 KB

I made a function in my package, something like this

FUNCTION get_script_version RETURN VARCHAR2
IS
    changed_date    VARCHAR2(60)    :=  '$DateTime$';
    change_list     VARCHAR2(30)    :=  '$Change$';
    revision        VARCHAR2(30)    :=  '$Revision$';
    changed_by      VARCHAR2(50)    :=  '$Author$';
BEGIN
    RETURN changed_date||'  '||change_list||'  '||revision||'  '||changed_by;
END get_script_version;

Then, in P4 client

1: right click on your desired files and then right click to select "change filetype" enter image description here

2: Then in new window, select on k+ attributes enter image description here

And submit the file. P4 will replace the $$ with respective values.

Was it helpful?

Solution

Actually, done some further googling after comment above and apparently perforce does support keyword substitution as described here. That may get you some way towards what you're trying to achieve.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top