Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,461,809
Community Members
 
Community Events
176
Community Groups

Using database schema name before table name in ScriptRunner Query

Hi All,

In all environment I have set the ScriptRunner resource as "local".

I am using following query in ScriptRunner script as follows:

DatabaseUtil.withSql('local') { sql ->
def row = sql.firstRow('select top 1 mc.SUBJECT, EML_PATH from jiraissue ji, project p, AO_89A25E_MAIL_COMM mc where p.id=ji.project and mc.issue_id=ji.id and CONCAT(P.PKEY, \'-\', ji.ISSUENUM)=? order by mc.DATE_SENT desc', issue.key)
if (row) {
subject = row. 'SUBJECT'}
}

The above SQL query works fine in DEV environment. However, this query throws an error in production environment.

To make this work in production, I had to add "JIRAISSUE." a schema name in front of the table name as below, however this will not work in DEV environment.

select top 1 mc.SUBJECT, EML_PATH from JIRAISSUE.jiraissue ji, JIRAISSUE.project p, JIRAISSUE.AO_89A25E_MAIL_COMM mc where p.id=ji.project and mc.issue_id=ji.id and CONCAT(P.PKEY, \'-\', ji.ISSUENUM)=? order by mc.DATE_SENT desc'

 

My Question is:

Is there a way where I can configure the database schema so that I need not put the schema name in query. 

May I request the experts to advise how do I remove this schema name inconsistencies between environments.

 

Thanking in advance.

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events