Writing a query that may require a pivot but include [month, year] in the column and RiskGrades, no aggregate?

Hello

new to oracle/mark. I need to write a query that will pull the customer details and on the columns, it will have the month-year: Jan2015, Feb2015... Dec2015.

on the lines, it will contain the details of the client. the information it will provide are the categories of risk to each month.

I create a query, but it uses a function to update and is very slow. There are approximately 3000 documents. An update of column required 15 minutes or even more. so an update of column takes 15 minutes * 9 to update until September.

the best ways to manage this demand?

my query is:

UPDATE tmpRiskGrades one

SET a.feb2015 =)

Select l.risk_grade

of rep_loanportfolio l

where a.agreementno = l.agreeement_no AND l.dtuserdatetime = February 28, 2015 ")

Certainly, that looks like a pivot base for me.  Assuming that dtuserdatetime is actually a date data type, something like that will not work in your version of non-recognition:

Select customer_no, agreeement_no, customer_address, loan_type region,

Max (case when dtuserdatetime = to_date (Jan 31, 2015 "," DD month yyyy ' "))

end of the era risk_grade) jan2015,.

Max (case when dtuserdatetime = to_date (February 28, 2015 "," DD month yyyy ' "))

then risk_grade end) Feb2015,

...

of rep_loanportfolio l

where loan_type = "HOME LOAN" and

account_status = 'LIVE' and

dtuserdatetime between to_date (Jan 31, 2015 "," DD month yyyy ' ") and

TO_DATE (31 Dec 2015 "," DD month yyyy ' ")

Group of customer_no, agreeement_no, customer_address, region loan_type

order of region loan_type, customer_no, agreeement_no, customer_address

If you are on 11.2 or higher, you could look at the PIVOT keyword, which is a more concise expression of the same thing.

John

Tags: Database

Similar Questions

Maybe you are looking for

  • Notification of 'Syntax error' constant JavaScript after the upgrade to 17.0

    Almost on every page, I opened appears after notification ' error: error of syntax "JavaScript application. Even on this page where I fill in the form.I have to click 'OK' several times to clear.

  • Mail.app keyboard shortcut conflict

    Hello I use things to manage tasks on my iMac (OS X El Capitan, up-to-date). Things has a quick entry hotkey-based function to add tasks with AutoFill from anywhere on the Mac. For example, mail.app you can press ⌘⌥⎵ to create a new task with a link

  • How to restore a Satellite A300 PSAGOE?

    Sorry if this is in the wrong place or has responded, but one of my friends want me to restore its Satellite A300, the only info that she can give me is that it works on Vista and it's a 03uo1yen of psagoe. She has no records for this laptop. She bou

  • Discrete cards compatibility with HP ENVY h8-1403es

    Hello My friend wants to change his 640gt included in a HP ENVY h8-1403es for another graphics card. He wants to install a 770gtx but it seems impossible because of lower power, not enough distance to place it in the pc box and has problems with moth

  • 6735 s gel (Win XP)

    I have a new laptop HP 6735 s, running under Windows XP (SP3). Since the early days, I had a problem with this gel in various situations, for example surf the internet or watch a DVD. Everything stops, and the computer stops responding. The only way