NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

The fields Level_2 and Level_1 in the provided SQL script are determined using hard-coded logic based on the value of the clientgroupname field. The hard-coded logic is outlined as follows:

Level_2: This field is determined based on the clientgroupname field using the following conditions:

If the clientgroupname is 'NVA', Level_2 is assigned the value of districtname.
If the clientgroupname is 'Absolut' or 'VEG', Level_2 is assigned a NULL value.
Level_1: This field is also determined based on the clientgroupname field but with slightly different conditions:

If the clientgroupname is 'NVA', Level_1 is assigned the value of divisionname.
If the clientgroupname is 'Absolut', Level_1 is assigned the value of districtname.
If the clientgroupname is 'VEG', Level_1 is also assigned a NULL value.
This logic is described as "hard-coded" because it is explicitly written into the SQL script and does not dynamically adapt based on changes in the data or schema. For instance, if a new clientgroupname is introduced, the script must be manually modified to account for the new data.

In a more dynamic or scalable implementation, such logic would ideally be stored in a separate table or a configuration file. This way, when new client groups are added or existing hierarchies change, the configuration can be updated without changing the SQL code itself. This might involve creating a table mapping clientgroupname to their respective hierarchy levels and updating the SQL script to determine Level_2 and Level_1 based on this configuration, rather than hard-coded conditions.


Yes, the provided PL/SQL block appears to be a program designed to update hierarchy levels (L1 through L4) for a client group named 'Heartland' in a dataset named pda_data_for_tableau_showcase_v2. This logic is somewhat related to the SQL query you provided earlier, as both deal with hierarchy levels (albeit with different naming, i.e., Level_1, Level_2 vs L1, L2, etc.) and client group associations.

Here's what the PL/SQL block does, step-by-step:

Declares a cursor named curated_heartland_cur that selects all distinct child MIDs from the pda_data_for_tableau_showcase_v2 table for the 'Heartland' client group where the level_1 value is not defined.

Opens a loop that goes through each MID from the cursor.

For each iteration, it checks if the current MID exists in the ccoc_account_data_base table and fetches its associated accountid.

Checks if the fetched accountid has a corresponding MID in the external_hierarchy_data_base table.

If a corresponding MID is found, it fetches the hierarchy levels (l1_vp, l2_rdo, l3_rmo, l4_pmo) for that MID.

Finally, it updates the corresponding hierarchy levels (level_1 through level_4) for the current record in the pda_data_for_tableau_showcase_v2 table using the fetched hierarchy levels.

This script is designed to deal with situations where some MIDs in the pda_data_for_tableau_showcase_v2 table might not have defined hierarchy levels. It attempts to find the missing hierarchy data by finding 'similar' MIDs that are associated with the same account in the ccoc_account_data_base table, then using the hierarchy data from those 'similar' MIDs to fill in the missing data.
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.