From the list of values in the procedure and trying to validate values

Hello

I create a procedure that will allow to validate data entered by the user.  Users can add values in a text box on my web page and I need to pass to an oracle procedure and check the table if these values exist.  I need to return a list of values that do not exist.  That's what I have so far

CREATE OR REPLACE PROCEDURE VALIDATE 
(
  P_VLIST IN VARCHAR2 ,
  P_RECORDS OUT SYS_REFCURSOR
)
AS
  V_SQL VARCHAR2(4000) := '' ;
BEGIN
V_SQL :=          'SELECT VAL '||CHR(10) ;
V_SQL := V_SQL || 'FROM DVALUES '||CHR(10) ;
V_SQL := V_SQL || 'WHERE VAL NOT IN (' || P_VLIST || ')'||CHR(10) ;
V_SQL := V_SQL || ' ORDER BY VAL' ||CHR(10) ;
OPEN P_RECORDS FOR V_SQL;
END VALIDATE ;
/

My problem is that it will return all the values of DVALUES.  Can I put my list into a temporary table and do a left join to DVALUES and where the values of the two tables I can create a bool column that has a 1 or 0 indicating whether or not the value is good then select on the table and return the list of bad values?

Thank you

SQL > CREATE OR REPLACE
PROCEDURE (2) P_VALIDATE
3 P_VLIST IN VARCHAR2,
4 P_RECORDS OF THE SYS_REFCURSOR
5                        )
6 AS
V_STMT 7 VARCHAR2 (4000);
BEGIN 8
9 V_STMT: = ' SELECT ELEMENT FROM (SELECT ";)
10 V_STMT: = V_STMT | REPLACE (P_VLIST, ',', 'ELEMENT OF DOUBLE UNION ALL SELECT');
11 V_STMT: = V_STMT | FROM DUAL) WHERE THERE IS NO (SELECT 1 FROM DVALUES WHERE VAL = ELEMENT)';
12. OPEN P_RECORDS TO V_STMT;
13 END P_VALIDATE;
14.

Created procedure.

SQL > EXEC P_VALIDATE('10,15,20,25,30,35,40',:V_CUR)

PL/SQL procedure successfully completed.

SQL > V_CUR PRINT

ELEMENT
----------
15
25
35

SQL >

SY.

Tags: Database

Similar Questions

  • Hi, I created the procedure and its code is / / DELETE FROM <? = odiRef.getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "", "D")? > / / and when I'm running, the error appeared //com.sunopsis.tools.core.exception.SnpsSimpleMessageExcepti

    Hi, I created the procedure and its code is / / DELETE FROM <? = odiRef.getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "", "D")? > / / and when I'm running, the error appeared.

    com.sunopsis.tools.core.exception.SnpsSimpleMessageException: ODI-17517: error in the interpretation of the task.

    Task: 1

    java.lang.Exception: the application script threw an exception: com.sunopsis.tools.core.exception.SnpsSimpleMessageException: Exception getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "DEVELOPMENT", "D"): SnpLSchema.getLSchemaByName (): SnpLschema is no information OSB: Delete_Tar_Sales on line: column 0: columnNo

    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:489)

    at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:737)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:465)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:366)

    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)

    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:292)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:855)

    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)

    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)

    at java.lang.Thread.run(Thread.java:662)

    Caused by: java.lang.Exception: the application script threw an exception: com.sunopsis.tools.core.exception.SnpsSimpleMessageException: Exception getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "DEVELOPMENT", "D"): SnpLSchema.getLSchemaByName (): SnpLschema is no information OSB: Delete_Tar_Sales on line: column 0: columnNo

    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:476)

    ... 11 more

    Caused by: org.apache.bsf.BSFException: the application script threw an exception: com.sunopsis.tools.core.exception.SnpsSimpleMessageException: Exception getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "DEVELOPMENT", "D"): SnpLSchema.getLSchemaByName (): SnpLschema is no information OSB: Delete_Tar_Sales on line: column 0: columnNo

    at bsh.util.BeanShellBSFEngine.eval (unknown Source)

    at bsh.util.BeanShellBSFEngine.exec (unknown Source)

    at com.sunopsis.dwg.codeinterpretor.SnpCodeInterpretor.transform(SnpCodeInterpretor.java:471)

    ... 11 more

    Text: REMOVE OF <? = odiRef.getObjectName ("L", "TRG_SALES", "ORACLE_ORCL_LOCAL_SALES", "", "D")? >.

    at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:764)

    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:465)

    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ 2.doAction(StartSessRequestProcessor.java:366)

    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)

    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 0 (StartSessRequestProcessor.java:292)

    to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:855)

    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)

    to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:82)

    at java.lang.Thread.run(Thread.java:662)

    If you do this in a procedure, use the following syntax:

    <%=odiRef.getObjectName("L", "TRG_SALES", "D")%>

    and set the relevant logical schema in the options on the target tab of the procedure. Also, make sure you only select the correct technology type in the options on the target tab.

  • hr_assignment_api.update_emp_asg_criteria - contact your system administrator citing the procedure and step 40.

    Hi all

    I looked online and found this question popping up but without a clear solution.

    I have reduced API hr_assignment_api.update_emp_asg_criteria to a minimum and still can't seem to update my existing assignment. I use all the current values on the assignment so I know that all values are valid and configuration. Also, I checked and my people flexfield group is enabled and allowing the dynamic insertion. I also ran:

    INSERT INTO fnd_sessions (session_id, effective_date)

    Select ('sessionid'), SYSDATE USERENV

    of the double

    If USERENV('sessionid') not in (select SESSION_ID from fnd_sessions);

    Any help would be greatly appreciated!

    I get the error:

    Error report-

    ORA-20001: System error: procedure in step 40

    Cause: The procedure created a mistake in step 40.

    Action: Contact your system administrator citing the procedure and step 40.

    ORA-06512: at "APPS.HR_ASSIGNMENT_API", line 17385

    ORA-06512: at "APPS.HR_ASSIGNMENT_API", line 15701

    ORA-06512: at "APPS.HR_ASSIGNMENT_API", line 15486

    ORA-06512: at line 26 level

    And here is my code:

    DECLARE

    ln_special_ceiling_step_id PER_ALL_ASSIGNMENTS_F.SPECIAL_CEILING_STEP_ID%TYPE;

    lc_group_name VARCHAR2 (30);

    ld_effective_start_date PER_ALL_ASSIGNMENTS_F.EFFECTIVE_START_DATE%TYPE;

    ld_effective_end_date PER_ALL_ASSIGNMENTS_F.EFFECTIVE_END_DATE%TYPE;

    lb_org_now_no_manager_warning BOOLEAN;

    lb_other_manager_warning BOOLEAN;

    lb_spp_delete_warning BOOLEAN;

    lc_entries_changed_warning VARCHAR2 (30);

    lb_tax_district_changed_warn BOOLEAN;

    -Select * from per_all_assignments_f where assignment_id = 18525;

    ln_ORGANIZATION_ID PER_ALL_POSITIONS.ORGANIZATION_ID%TYPE: = 612;

    ln_LOCATION_ID PER_ALL_POSITIONS. LOCATION_ID % TYPE: = 161;

    ln_job_id PER_ALL_POSITIONS. JOB_ID % TYPE: = 76;

    ln_grade_id HR_ALL_POSITIONS_F.entry_grade_id%TYPE: = 84;

    ln_assignment_id PER_ALL_ASSIGNMENTS_F.ASSIGNMENT_ID%TYPE: = 18525;

    ln_person_id NUMBER: = 23729;

    ln_object_number NUMBER: = 5;

    ln_people_group_id NUMBER: = 2410;

    BEGIN

    () hr_assignment_api.update_emp_asg_criteria

    p_effective_date = > trunc (sysdate),.

    p_datetrack_update_mode = > "CORRECTION."

    p_assignment_id = > ln_assignment_id,

    p_location_id = > ln_LOCATION_ID,

    p_grade_id = > ln_grade_id,

    p_job_id = > ln_JOB_ID,

    p_organization_id = > ln_ORGANIZATION_ID,

    p_people_group_id = > ln_people_group_id,

    p_object_version_number = > ln_object_number,

    p_special_ceiling_step_id = > ln_special_ceiling_step_id,

    p_group_name = > lc_group_name,

    p_effective_start_date = > ld_effective_start_date,

    p_effective_end_date = > ld_effective_end_date,

    p_org_now_no_manager_warning = > lb_org_now_no_manager_warning,

    p_other_manager_warning = > lb_other_manager_warning,

    p_spp_delete_warning = > lb_spp_delete_warning,

    p_entries_changed_warning = > lc_entries_changed_warning,

    p_tax_district_changed_warning = > lb_tax_district_changed_warn

    );

    END;

    It turns out that all of my trouble was because of NLS parameters in SQL Developer. Tools > settings > database > NLS. Now, I chose to ignore the settings NLS and things work much better.

  • How to pick up the procedure and the slider for oracle procedure

    How to pick up the procedure and the slider for that?

    SELECT aktualne_notowania.aspolka_id,
    aktualne_notowania.Notowanie * spolki.ilosc_akcji as total
    To aktualne_notowania, spolki
    WHERE aktualne_notowania.aspolka_id = spolki.spolka_id;
    something like

    create or replcae procedure test_proc() is
    v_es_id polski_table.id%type;
    number of v_mult_val;

    cursor c1 is
    Select q.id, (q.quantity * p.price) as total_amount
    the quantity q
    price p
    where q.itemId = p.itemId

    Start

    Open c1
    loop
    Fetch c1 into v_es_id, v_mult_val;
    When exit c1% notfound;

    Update table_target
    total value: = v_mult_val
    where id: = v_es_id;

    end

    Something like this:

    merge into table_target t
    using (select select q.id, (q.quantity*p.price) as total_amount
           from   quantity q
                , price p
           where q.itemId = p.itemId
          ) s
    on    (t.id = s.id)
    when  matched then update
          set t.total = s.total_amount;
    
  • After you create a new playlist in iTunes, every song has the cover of the album and no box on the left side. How can I remove from the work and recover the box? TIA

    After you create a new playlist in iTunes, every song has the cover of the album and no box on the left side. How can I remove from the work and recover the box? TIA

    You can change the appearance of a selection by clicking on "reading list" in the upper right of the iTunes window. The desired view is probably "tracks"

  • I have a Nikon D600 and downloading photographs to Lightroom 6.1 all images have their settings far from the truth and is no where near what is shown to the camera, i.e. temp is 3800 and tinted 80 magenta, other parameters are also in. other Nik

    I have a Nikon D600 and downloading photographs to Lightroom 6.1 all images have their settings far from the truth and is no where near what is shown to the camera, i.e. temp is 3800 and tinted 80 magenta, other parameters are also in. other Nikon cameras do not. Everyone knows about this problem?

    Looks like you are applying (accidentally) a "Preset" for these photos. Make sure that there is no preselection specified in the import dialog box, and the first (bottom) in the history of develop does not list a preset.

  • 2 How to remove an element from the tree and the database block tree?

    Hello

    2 How to remove an element from the tree and the database block tree?

    Kind regards

    Abdetu...

    The problem is caused by not sending forms is not a VALIDATION of the database because he thinks that there is no changes to save.

    Forms does know that changes to the data block, he does not know the changes made by the PLSQL INSERT, UPDATE, DELETE calls and procedure.

    Try to remove the line to block, rather than using a DELETION like that...

    go_block ('INSP_EQUIPMENT_TYPE');if form_success then   do_key ('DELETE_RECORD');end if;
    
    
    

    If you wish to continue using your original DELETE instead of my change above code, you can use different techniques to force forms to issue the COMMIT to the database, including this one...

            DELETE ...        FORMS_DDL ('COMMIT');
    

    Be careful... This will be the VALIDATION of the database, but the changes to the data block will not be sent to the database!

    I posted a few other ways to issue a VALIDATION of forms here
    www.seeristic.com/Forum_Posts/Forms_COMMIT.txt

  • Is it possible to remove pictures/videos from the iphone and have yet to back them up in the iCloud?

    Is it possible to remove pictures/videos from the iphone and have yet to back them up in the iCloud?

    At the moment the iCloud synchronizes only with what is already on my iPhone.

    This article should help you remove photos from my photo - Apple Support stream

  • all of my photos in icloud were removed from the restoration (and did not find the album recently removed to icloud)



    all of my photos in icloud were removed from the restoration (and did not find the album recently removed to icloud)

    The opposite happened to me - in the opposite direction! I found all my pictures from Nokia mobile in icloud on my iPad a few days ago, had no blue cogwheels devices! The two devices + home phone is all about wireless internet of the contract with ORANGE in Europe! They will not help,

    I think my router - put in place by an expatriate for me - is hacked because of the problem. I didn't ask him to change my contract or warn of my move when I did 2 years ago - but he went ahead and made Orange disclose no information telling me his "confidential".

  • I downloaded Itunes 12.3.3 and now I tunes does not recognize my Ipad or Iphone. I went through all the procedures and just uninstall and reinstall. Please fix 12.3.3.Thanks.

    I downloaded Itunes 12.3.3 and now I tunes does not recognize my Ipad or Iphone. I went through all the procedures and just uninstall and reinstall. Please fix 12.3.3.Thanks.

    iTunes: fix iPhone or iPod not detected Windows 10

  • After a second, a number of categories disappear from the website and I can't read more?

    1. Question

    After a second, a number of categories disappear from the website and I can't read more?
    For instantance that I am looking for a telefoonnumber, I became the address and number once a second number disappears

    If you have installed Skype extension disable it.

  • The beeps from the BIOS and graphics problem

    1. when I start my computer (h9-1350), I get 6 short beeps, the computer is for a just half a minute, then continue to boot normally. I think it has something to do with a keyboard. I tried two different keyboards... KB USB provided with the computer and solar keyboard K750 from Logitech. He also sometimes appears an error message that I did not copy but the message said something about a keyboard.

    2. I can't get into BIOS to do the steps from HP FAQ Web site provides for the installation of a spare video card. As does the 6 beeps from the computer and then boots normally apparently it does not the button configuration screens to access the BIOS.

    The computer is a HP h9-1350 with Win8.

    H9-1350 HP / Intel i7 3770 / 12 GB
    Windows 8 / HP w2207 monitor / Radeon 6870
    Keurig ready for a coffee or Cup of hot tea

    Okay, I think that we have a fix/resolve. I found the LEGACY (just above), set it to Enable. I replaced the OEM video card with my Radeon 6870 and it booted right up less beeps. Thanks for the help.

    BTW, where can I find more information about this 'new' (for me at least) UEFI BIOS? I had no idea what Win8 make this change.

    Thanks again.

  • I'm from the Argentina and I bought an Iphone in Miami 2 weeks ago. When I arrived to my country, I realized that the iphone did not work. There is no Apple store in the country of mi, but I am going to the Uruguay in the next few days. Can I change it he

    I'm from the Argentina and I bought an Iphone in Miami 2 weeks ago. When I arrived to my country, I realized that the iphone did not work. There is no Apple store in the country of mi, but I am going to the Uruguay in the next few days. Can I change it here?

    # Given that the iPhone was purchased from the United States which is the place you can have anything done using the guarantee. You or your agent must submit to Apple in the United States, because Apple does not accept foreign shipments.

  • I've implemented all the information for an email from the Charter and then when I click on get mail, it says there is a connection to the server error... Why?

    I've implemented all the information for an email from the Charter and then when I click on get mail, it says there is a connection to the server error... Why?

    Hello ChevyDriver10,

    Thanks for your post.  What email app do you use to receive your mail?

    In the meantime, take a look at the Charter of General electronic installation instructions.

    If you do not currently have an e-mail client, feel free to go on Windows Live Mail.

    See you soon

  • Is there a way to copy the drivers and setup of the drive from the computer and transfer them to the reader of the dead computer?

    Separated from this thread.

    Is there a way to copy the drivers and setup of the drive from the computer and transfer them to the reader of the dead computer?

    Hello

    You cannot copy the drivers installed anyway.

    Saving your files:

    You can remove the hard drive and put it in a hard drive USB enclosure > plug it into another computer > and try to read and copy your data in this way.

    See you soon.

Maybe you are looking for

  • iPhone Photo / video storage?

    Hello I have an iPhone 64 GB 6 s. I use the photos app with thousands of pictures and videos stored in the cloud. I have "value for the storage of the iPhone" enabled on my phone, but still have "photos and camera" with 30 GB of my iphone storage (my

  • How to print a PDF of boarding

    I want to print my boarding jet2 holidays, but he says you must have an adobe reader, but my iPad Air support not Adobe can anyone help please?

  • Re: master code for administrator password or power on password for HP Pavilion m6

    wood password forgotten and is told off System [70445473]

  • Cannot open attatchments in email

    cannot open attachments in windows mail on vista.  whenever I try to open it almost flashes and not do anything, and when I try to record it says not to run the command do not know what is going on help me... Please

  • Explorer Windows 7 retains overwhelming

    Hi, I was tring to help a friend with a computer problem. Last week, I got ro to re - install the computer because I couldn't find a solution. The problem is whenever we open the documents folder on the profile kates files Explorer just stops and res