PeopleTools and Lifecycle Management - PSFT (MOSC)

MOSC Banner

Inititalize a value retrieved from DB to variable stored in Database

Hi,

Is it possible to assign a value in one variable to the same variable that is setup or stored as "&" variable?

For EX:

The SQLEXEC returns a year of 2022 and stores it in &YEAR.

We have the same "&YEAR" value is stored in one of custom tables

Table Structure (COUNTRY_TBL) and sample value

Country CUSTOM_VALUE

US &YEAR

Now, when we query on COUNTRY_TBL and retrieve the CUSTOM_VALUE, we have &YEAR

Is it possible to pass the 2022 value obtained in 1st SQLEXEC to above &YEAR?

So, the value in &YEAR should be assigned to the variable &YEAR stored in COUNTRY_TBL.CUSTOM_VALUE

Any help is appreciated

Thanks & Best Regards,

Sundeep

Answers

  • Hi Sundeep

    Are you intending to update COUNTRY_TBL.CUSTOM_VALUE with 2022 into the DB? or you just want the value of the output from COUNTRY_TBL.CUSTOM_VALUE to be 2022 at run time in PeopleCode only?

    Thanks

    Sundeep

  • NSR
    NSR Posts: 62 Blue Ribbon

    Hi Sundeep,

    Thanks for responding

    I want the output (i.e. &YEAR) from COUNTRY_TBL.CUSTOM_VALUE to be 2022 at run time in PeopleCode

    I'm attaching the table contents below for your reference

    image.png


    Thanks & Best Regards,

    Sundeep

  • Hi Sundeep

    you could simply use Evaluate Statement to assign the value of variable to the field at run time. I am assuming that you would have variables &YEAR and &YEAR1 already populated

    Evaluate COUNTRY_TBL.CUSTOM_VALUE

    When = "&YEAR"

    COUNTRY_TBL.CUSTOM_VALUE = &YEAR

    Break;

    When = "&YEAR1"

    COUNTRY_TBL.CUSTOM_VALUE = &YEAR1

    Break;

    End-Evaluate


    Thanks

    Sundeep

  • NSR
    NSR Posts: 62 Blue Ribbon

    Hi Sundeep,

    Sorry if I'm confusing. The requirement was indeed confusing.

    My requirement is to have the value "&VALUE" (stored as value in DB) assigned with &VALUE (from SQLEXEC)

    The value "&VALUE" itself is a value stored in COUNTRY_TBL.CUSTOM_VALUE field. So, I want this to be populated with the value present in bind variable &YEAR (obtained from SQLEXEC)

    Once again, I apologize for the confusion

    Thanks & Best Regards,

    Sundeep

  • Hi Sundeep


    I am still confused with the requirement but I still feel like you can simply use the Evaluate or even directly update the COUNTRY_TBL.CUSTOM_VALUE

    update ps_country_tbl set custom_value = (SQL from SQLEXEC) where custom_value = chr(38)|| 'YEAR'.

    Thanks

    Sundeep

  • NSR
    NSR Posts: 62 Blue Ribbon

    Hi Sundeep,

    Never Mind.

    Thanks for your time and it was nice interacting with you

    Thanks & Best Regards,

    Sundeep

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center