Deploy several VM in CSV file

Hi all

I'm new to powercli and powershell so forgive if my terminology is not correct.  At this point, I can really only change scripts to work in my environment and you're looking for here.

I'm trying to deploy a number of virtual machines with all the information required of VM in a CSV file.

The script is attached below.

This is the error I get.

Get-VMHost: Impossible to validate the argument on the parameter 'name '. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

I think that am not pass the variable correctly here, it's in the script

$VMHost = get-VMHost $vm.host

But when I read in the CSV data using the Import-CSV cmdlet that I get

Import-CSV Y:\file.csv

VMname: CEIVIRPAS0158

$vmhost: ceiatlpvs0004.mgmt.int

data store: CEIVSC0002_EATL0NET03_LUN3

model: W2008R2_SP1_EE_TEMPLATE

customization: CIS 2008

IP address: 10.211.80.142

subnet mask: 255.255.255.0

defaultgw: 10.211.80.1

DNS1: 10.211.68.50

DNS2: 10.211.68.49

DiskType: dish

storageformat: Thin2GB

capacityKB: 20971520

Description: RTIP Administration Server Web 9 of 10

any ideas would be very help, thanks!

Make sure you use the right names in the header of the CSV file?  The error message seems to indicate that $vm.host is a $null value.

Your import seems to indicate that values should be $vm. VMhost.  Unless I'm reading something wrong.  It is the same for the $VMName variable.  You have defined on $vm.name, but the importation was listed as $vm. VMname.

--j

Tags: VMware

Similar Questions

  • Several deployments VM referencing a CSV file - what are csv headings?

    Hi all

    I'm having some difficulty with a CSV file and the creation of multiple virtual machines of script and I was wondering if anyone could help please?

    I have a CSV file with the following headers:

    Name of the server, ESX host, Datastore, NumCPU, MemoryGB, DiskGB, name, disk storage Format, the network ID

    Test-SVR10, 192.168.1.50, ds_01, 1, 4, 40, the VM, slim network, winnetstandardguest

    What I need to add is the type of network adapter (I have a mixture of vmxnet3 and e1000 to deploy) and several discs by VM.

    The script that I have is:

    "c:\scripts\vm-list.csv" import-csv - useculture | %{

    new-vm-name $_. "' Server name '-VMHost $_. "" The ESX host "Datastore-$_. Data store - NumCPU $_. NumCPU - MemoryGB $_. MemoryGB-DiskGB $_. "" DiskGB "-NetworkName $_. "" Network name "DiskStorageFormat-$_. "" The disk storage Format '-ID $_. ID

    }

    If I was typing this one line at a time. (or by using a batch file I think) I could use - DiskGB 10,20,30 adding several drives on the virtual computer, but I can't seem to add in the CSV file, and the error message says something about - parameter which I don't understand.

    I guess it's a case of getting the column headers correct for the information I need to add. Is there a list of topics CSV somewhere?

    It might be interesting to note that I am simply provide the hull of the virtual machine is deployed - are there no need to use a customization script or clone an existing virtual machine / deploy from an existing template.

    See you soon.

    The New-VM cmdlet can handle a table of values for the DiskGB parameter.

    Don't know how you set the disk sizes in the CSV file, but if you placed in the single column, it should be read as a string.

    But you can convert this string to an array.

    For example:

    If you entered '10/20/30' in the DiskGB column in the CSV file, you can do $_. DiskGB.Split('-') for a picture with the 3 values.

  • Deployment, customization and modification of virtual machines to a csv file

    Hello

    With lots of help from Eco91, I realized the script below.  He deploys a series of virtual machines at the same time, waiting that they to initialize and make customization of the OS, and then changes the basis of networking within the OS and also changes in the Description of the network:

    $esxName = 'esxqac4s01. MYDOMAIN.local ".
    $template = "TEST_W2K8R2ENTSP1".
    $datastore = "NFS_VM_Storage01".
    $newVmList = @)
    @{"Name" = 'TESTSVR1'; 'IP' = "10.244.186.136"; 'Mask' = "255.255.255.0". "Gateway" = "10.244.186.1"; "DNS" = @("10.244.37.25", "10.244.37.26"); "NetworkName" = "VLAN186_QA"; },
    @{"Name" = 'TESTSRV2'; 'IP' = "10.244.186.137"; 'Mask' = "255.255.255.0". "Gateway" = "10.244.186.1"; "DNS" = @("10.244.37.25", "10.244.37.26"); "NetworkName" = "VLAN186_QA"; },
    @{"Name" = 'TESTSRV3'; 'IP' = "10.244.186.138"; 'Mask' = "255.255.255.0". "Gateway" = "10.244.186.1"; "DNS" = @("10.244.37.25", "10.244.37.26"); "NetworkName" = "VLAN186_QA"; },
    @{"Name" = 'TESTSRV4'; 'IP' = "10.244.186.139"; 'Mask' = "255.255.255.0". "Gateway" = "10.244.186.1"; "DNS" = @("10.244.37.25", "10.244.37.26"); "NetworkName" = "VLAN186_QA"; }
    )
    $custSpec = "TEST_W2K8R2ENTSP1".
    $location = "_Tobedeleted".
    $taskTab = @ {}
    SE connect-VIServer-Server vvcqa01yyz. MYDOMAIN.local - user 'MYDOMAIN\MYACCOUNT' - password MYPASSWORD
    # Create all virtual machines specified in $newVmList
    {foreach ($VM to $newVmList)
    $taskTab [(nouvelle-VM-nommez $VM.)] Name - VMHost (Get-VMHost-name $esxName) - model $template - $datastore - OSCustomizationSpec $custSpec Datastore - location $location - RunAsync). ID] = $VM. Name
    }

    # Start each virtual machine that is over
    $runningTasks = $taskTab.Count
    While ($runningTasks - gt 0) {}
    Get-job | % {
    If ($taskTab.ContainsKey ($_.)) (ID) - and $_. State - eq 'Success') {}
    Get - VM $taskTab [$_] ID] | Start-VM
    $taskTab.Remove ($_.) ID)
    $runningTasks-
    }
    else if ($taskTab.ContainsKey ($_.)) (ID) - and $_. State - eq "Error") {}
    $taskTab.Remove ($_.) ID)
    $runningTasks-
    }
    }
    Start-Sleep - seconds 5
    }


    # START HERE
    # Wait for customization of the OS
    Start-Sleep - seconds 300
    # Customize network
    {foreach ($VM to $newVmList)
    Get-NetworkAdapter - VM $VM. Name | Together-NetworkAdapter NetworkName - $VM.NetworkName - confirm: $false
    Get-VM-name $VM. Name | 'Administrator' Get-VMGuestNetworkInterface - Guestuser - GuestPassword ' R! m2009 |? {$_.name - eq "Connect to network Local 4"} | Game-VMGuestNetworkInterface - Guestuser 'Administrator' - GuestPassword ' R! m2009"- IPPolicy - static IP $VM. $VM.Netmask - IP-Gateway $VM subnet mask. Gateway - DNS $VM. DNS
    }

    I would now like to replace the $VMlist variable and put rather information eVM th to a .csv file.  Any suggestions?

    Hello

    assuming this is your csv file

        "name","ip","netmask","gateway","dns","networkName"    "TESTSRV1","10.244.186.136","255.255.255.0","10.244.186.1","10.244.37.25;10.244.37.26","VLAN186_QA"
    

    you have a problem. Impossible to save all the tables in a csv file and do powershell natively recognize them.

    Instead, use a delimiter custom (not the same csv uses!) and split - to import - in a table. Look at the semicolon between two dns servers.

    $newVmList = import-Csv test.csv | Select-Object - property 'name', 'ip', 'mask', 'bridge', @{Name = "dns"; {Expression = {$_ .dns-split ';'}}, "networkName".

    The object resulting looks like this

        name       : TESTSRV1    ip         : 10.244.186.136    netmask    : 255.255.255.0    gateway    : 10.244.186.1    dns        : {10.244.37.25, 10.244.37.26} <-- Array    networkName: VLAN186_QA
    

    Concerning

    Emanuel

  • Deploy the CSV file virtual computer

    Hello world!

    I want to deploy multiple VM to a .csv file. I know this is pretty basic, but I don't get to work... What I've done wrong?

    Here's my scrypt:


    $list = import-CSV C:\config1_new_vm.csv
    Write-Output $list

    $vcenter_ip = "192.168.0.14.
    SE connect-VIServer-Server $vcenter_ip-user root - password password

    foreach ($line in $list)
    {
    New-VM-name $line.name - host $line.host Datastore - $line.datastore - DiskMB $line.disk MemoryMB - $line.memory - NumCPU $line.cpu - ID rhel5_64Guest - CD - Description 'RH5 Linux '.
    }

    Here my .csv file:

    2011-10-29_114608.png

    The result is:

    name host datastore. disc; memory; UC

    -----------------------------------

    VM1 h1e0mudag - a.dc.infra.com h1e0mudag-local-storage. 200; 512; 1

    h1e0mudag - a.dc.infra.com; h1e0mudag-local-storage; 300; 513, VM2; 2


    New-VM: could not validate argument on the parameter 'Name '. Argument is null or empty.

    Because I'm French, the message is in French, but for those who do not understand French, it basically means:

    Unable to validate the argument in the parameter 'Name '. The argument is Null or is empty.

    I do not understand... I can select my csv file lines but could not get the colomns... Is New-VM-name $line.name not right?

    Thanks for your replies.

    Pozitim


    Try changing the line

    $list = import-CSV C:\config1_new_vm.csv

    in

    $list = import-CSV C:\config1_new_vm.csv - UseCulture

    By default, PowerShell expects the separator in CSV files to be a comma.
    Your output, it seems as if your regional settings set the separator like semicolumn.
    With the UseCulture switch the cmdlet will use the locale to determine the separator.
  • Several Variables import from CSV file

    Hello PowerCLI Masters!

    I've been dabbling in PowerCLI now for about 6 months, especially for larger deployments VM.  I've been tweaking my scripts to automate more over time.  I started with setting all the variables manually and just import the virtual machine to a txt file names, then created several loops in a single script that would incorporate different text files, depending on model, data store, disc sizes VLAN, etc..

    I think that the next step here is to import variables by vm (essentially, a line of a CSV file).  We receive our demands for construction as a spreadsheet, so it would be relatively easy to fill in the correct fields in a spreadsheet and run a script that will import values.  I can't seem to put on the right track with the simple search, so I thought I'd post it here and see if:

    1. someone already did and can provide guidance

    2. can someone put me on the right track to how I would go all this

    3. someone tell me that it is not possible (in the hope that it does not go down like that, but it is certainly possible)

    This IS JUST a SAMPLE of the SCRIPTS - may or may not have a syntax perfect at this stage...

    # SET VARIABLES #.

    $vmname = get-content C:\PowerShell\serverlist_1.txt
    $vmname | {foreach-object
    $vmname = $_

    $templatename = "TMPLT-GSI.
    $folder = "GSI".
    $date = get-Date - uformat "%Y %m %d '.
    $expdate = "20110930".
    $reqno = "00034.
    $sysowner = "GSI".

    $esxhost = "esxhost1.test.com".
    $datastore = "DATASTORE_1".

    $cpu = 1
    $mem = 4096
    $datadrive1 = 26214400

    $datadrive2 = 52428800
    $pgname = "ECOM_902".

    #

    # BUILD/CONFIGURE VM #.

    #

    New-VM - vmhost $esxhost - name $vmname - model $templatename - Datastore $datastore - thick DiskStorageFormat - location $folder

    New-disk-hard - vm $vmname - CapacityKB $datadrive1
    New-disk-hard - vm $vmname - CapacityKB $datadrive2
    Get-VM-name $vmname | $mem set-VM - MemoryMB - NumCPU $cpu - confirm: $false
    Get-networkadapter $vmname | together-networkadapter - networkname $pgname - confirm: $false
    Get-VM-name $vmname | Game-CustomField-name "creation Date" - value $date - confirm: $false
    Get-VM-name $vmname | Game-CustomField-name 'expiry Date' - value $expdate - confirm: $false
    Get-VM-name $vmname | Game-CustomField-name "Application number" - value $reqno - confirm: $false
    Get-VM-name $vmname | Game-CustomField-name "Proprietary system" - value $sysowner - confirm: $false

    }

    So, rather than setting these values in the script, I want to shoot them from a spreadsheet that looks like this (a partial list at condition of course):

    $vmname$templatename$cpu$mem$pgname$datadrive1$datadrive2
    Testdeploy001TMPLT RHEL614'ECOM_902 '.2621440052428800
    Testdeploy002TMPLT-2008_ENT_6428'ECOM_902 '.26214400104857600
    Testdeploy003TMPLT-2008_ENT_6428'ECOM_906 '.26214400104857600


    Thanks in advance for any help provided!

    -Brent

    vmname TemplateName central processing unit MEM pgname datadrive1 datadrive2 folder
    Testdeploy001 TMPLT RHEL6 1 4 'ECOM_902 '. 26214400 52428800 GSI
    Testdeploy002 TMPLT-2008_ENT_64 2 8 'ECOM_902 '. 26214400 104857600 GSI
    Testdeploy003 TMPLT-2008_ENT_64 2 8 'ECOM_906 '. 26214400 104857600 GSI

    I would do something like this:

    $date= Get-Date -uformat "%Y%m%d"
    $expdate="20110930"
    $reqno="00034"
    $sysowner="GSI"
    $esxhost="esxhost1.test.com"
    $datastore="DATASTORE_1"
    
    Import-CSV C:\PowerShell\serverlist.csv | Foreach {
     New-VM -vmhost $esxhost -Name $_.vmname -Template $_.templatename -Datastore $datastore -DiskStorageFormat thick -Location $_folder
     New-Harddisk -vm $_.vmname -CapacityKB $_.datadrive1
     New-Harddisk -vm $_.vmname -CapacityKB $_.datadrive2
     Set-VM -VM $_.vmname -MemoryMB $_.mem -NumCPU $_.cpu -Confirm:$false
     get-networkadapter $_.vmname | set-networkadapter -networkname $_.pgname -Confirm:$false
     Get-VM -Name $_.vmname | Set-CustomField -Name "Creation Date" -Value $date -Confirm:$false
     Get-VM -Name $_.vmname | Set-CustomField -Name "Expiration Date" -Value $expdate -Confirm:$false
     Get-VM -Name $_.vmname | Set-CustomField -Name "Request Number" -Value $reqno -Confirm:$false
     Get-VM -Name $_.vmname | Set-CustomField -Name "System Owner" -Value $sysowner -Confirm:$false
    }
    
  • Export several pieces of information into a single CSV file

    Hi guys,.

    I try to export the information to a .csv file.  At the end of the day, I want the following information in the CSV file with the following headers:

    Name, NumCpu MemoryMB, Description, NetworkName


    I can get all the information for the first four topics (name, Description, NumCpu, MemoryMB) with the following command:

    Get - VM MYVM | Select Name, NumCpu, MemoryMB Description | Export-Csv-path "c:\outp\VMs.csv" - NoTypeInformation

    For the VLAN (aka NetworkName) I run the following command:

    Get - VM MYVM | Get-NetworkAdapter | Select NetworkName | Export-Csv "c:\output\VMs.csv" - NoTypeInformation

    The command to run successfully, however the second command is to crush the first information.  I tried - add the switch which gives an error, which suggests that I use - force, I also tried, that is the best that I could realize all the information exported, but with the unwanted spaces.  Is there an easy way to combine these two orders and export them to the CSV on the same line?

    Thank you.

    Use a calculated property.

    Try like this

    Get - VM |

    Select the name, NumCpu MemoryMB, Description,@{N='NetworkName'; {E = {Get-NetworkAdapter - VM $_______ | select - ExpandProperty NetworkName}} |

    Export-Csv-path "c:\outp\VMs.csv" - NoTypeInformation

  • Merge with VB Script ascii_diadem_9.1_or_later.zip .csv files: how to add the column/channel with filename

    Hello

    I use ascii_diadem_9.1_or_later.zip to merge the data from several .csv files.

    The problem is that I am so some weird futuristic timestamps in a channel

    which do not appear in the original .csv files:

    How to adjust the VB Script automatically adds a new channel to the a .csv resulting

    file with the original name of the .csv file for debugging purposes?

    Any help is greatly appreciated!

    Thanks, Katharina

    Hi Katharina,

    What happens when you drag your tiara BROWSER or Windows Explorer data files in the data portal?  See all date/time values in a table in VIEW of this channel?  The problem may be that you do not have a use but which properly load your data files.  The example is designed to show you how to concatenate several files of data together, but assumes that you could provide / have your own use.  If you use work already, then look for these lines to the top of the VBScript and substituting the name of your use "CSV".  If your files have a file extension different "*.csv", then you must also change the line "FileExt '.

    FileExt  = ' CSV files, *.» CSV »  ' « *. DAT; *. CSV '.
    Use = "CSV" ' "' or 'SpecificDataPluginName '.

    Brad Turpin

    Tiara Product Support Engineer

    National Instruments

  • How to import a csv file in a histogram

    Hi, I'm looking for a way to be able to import data from a csv file in LabVIEW 8.6 have it create a histogram chart. I've seen this done before, so I know it's possible, I just need to some resources are started vi get me in the right direction. I have thousands of entries, and it gets teadious importation vi macros QI. Does anyone know of a vi, or the Toolbox that will give me the building blocks to do so. Appreciate any help, thanks, AJ

    Bob, the op clearly LabVIEW 8.6.

    AlphaDog,

    You have a shortened exaple of the data file you?  There are several channels or just one?

    No matter, if you look in mathematics-> palette of probability & statistics, you will find a Histogram.vi that will take a table of data and do a histogram out of it.  To display it, use a chart and change the type of route to be a bar chart.

  • . Reading CSV file

    Hello

    I know this question has been asked several times, but I did write read the. CSV file in labview. Although I read only first coloum and also it does not read the exact value. It is rounded to almost integer. I checked all the settings in the representation of the data, but have no luck. Someone can help me.

    Your 'CSV' file contains a semicolon as field separator.

    Your VI uses the separator by default when reading the file. The default value is a character from . You also index the column even twice.

    See attachment to see how to load the file you provided...

  • Model road CSV file deletes '0' field numbers called prefix Party

    I want to download more than 350 models of road using bat tool in CUCM 9.1. All models must have their field called prefix part numbers (outgoing calls) containing 10 numbers with "0" at the beginning. The problem is that the CSV file removes the dominant form of '0' figures. I tried to make the type cell in Excel as 'Text' and it worked and the '0' is held normally, but when I save and close the file and then open it again, the cell is set by default to the type "Général" and "0" is gone again! Change the format of CSV file to any other and download to CUCM system generates an error indicating that the file format is not supported.

    A sample entry in the CSV file is attached. I want to preserve the whole number '0541234567' in the field 'PREFIX_DIGITS_CALLED_PARTY '.

    Can someone help me how to download this large number of models of road while preserving the number "0" at the beginning?

    Yes, it's how excel works, so open again the file, adjust it, save, and run via BAT. I did deployment with extensions starting with 0 and it works very well as long as you keep it open.

    Chris

  • ColdFusion does not recognize the CSV files

    I have a local version of ColdFusion developer 10 on my local machine.

    I use ColdFusion to create a CSV file and save it on the server and create a link by using the following code.

    Browsers open the CSV file in a text file and I use link right click to save target, my Windows Explorer save a html file.

    It works on the other server, using the same code.

    I want to know are there any which configuration to set ColdFusion recognize the format of CSV file when saving the target and he lets browsers know how to use Excel to open CSV files.

    Your information and help is much appreciated,

    Kind regards

    Mouses,

    < Cfset thisPath = ExpandPath("*.*") >

    < cfset f_dir = GetDirectoryFromPath (thisPath) >

    < cfset what = "#dateformat (now (), 'mmddyy') ##timeformat (now (), 'hhmm') # .csv" >

    < cffile action = "WRITE" line = "" f_dir # # how # ""

    output = "MtField1, MyField2" addnewline = "Yes" >

    < cfloop query = "#myQuery #" >

    < cffile action = "APPEND" file = "" f_dir # # how # ""

    output = "Field1 # #, #Field2 # ' addnewline ="Yes">

    < / cfloop >

    < cfset lelien = "MyServer/report /" & what > »»

    < cfoutput > < a href = "#theLink #" > here is the file < /a > < / cfoutput >

    < br >

    There are several different themes play. I have them separate to make the code more manageable and scalable.

    Using your code, I've implemented the following quick test. It uses the embedded, cfartgallery data source, you have also.

    I placed the 3 files in the same directory. But this is usually unnecessary because you can pass the path of the directory as a variable.

    fileWrter.cfm

    Select the city, email

    artists

    Here is the file

    fileDownload.cfm

    You must first create the download file.

    File.CFC

  • vMotion of CSV file

    Hello

    I'm trying to host vMotion, a number of virtual machines (a few hundred).  I thought that a CSV file would be the fastest way using PowerCLI.  On paper this script seems complete and simple.  However, it will not work.  Get errors.  I based this on the deployment of virtual machines in CSV file.  You are looking for assistance.

    Please see the bulletin.

    $movelist = "C:\Scripts\VM Move\vmmove.csv".

    Import-Csv $movelist - UseCulture | %{

    Get-VM-name $. _ 'Server ' | Move-VM-Destination $. _ "host" - confirm: $false

    }

    The error message I get, he thinks that the name of the server is $. _ "Server."  What did I miss? I want that it takes the name from the VM of the CSV, do the same for the HOST name.

    Error:

    Get - VM: 11/07/2013-09:55:26Get - VMVM with name "$._Server" was not found using the specified filters.

    C:\Scripts\VM Move\Move_VM.ps1:24 char: 1

    + Get-VM-name $. _ 'Server ' | Move-VM-Destination $. _ "host" - confirm: $false

    + ~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo: ObjectNotFound: (:)) [Get - VM], VimException)
    + FullyQualifiedErrorId: Core_OutputHelper_WriteNotFoundError, VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

    Thank you

    Boston Tech Guy

    Answered my own question... STRIKE FAULT!  I got $. _ not $_.

    Thank you!

  • UTL_FILE put data in csv file

    The problem is that I have line break characters in my varchar column. And when I write them in the .csv file, it does not come in a single cell. Instead, it divides into several lines, wherever it finds the new line character. How should I solve this? I want the result in a single cell. Help, please.

    I changed the code to search the columns date separately. Thanks for the solutions. I'm fine now.

  • Load the CSV file

    I use Apex 3.2 and construction of a facility charge of csv file.
    I received a lot of help on this post
    Re: Validate CSV File
    I'm now able to load the data into my custom table.
    Before I do that I want to update the collection first, using this option if statement
    IF c001 IS NULL THEN
                c006    := 'APXIMP';
                c007    := c007 || 'Storekey is missing!';
              END IF;
    
              IF c002 IS NULL THEN
                c006    := 'APXIMP';
                c007    := c007 || 'Plan Delivery Moment is missing!';
              END IF;
    
              IF c003 IS NULL THEN
                c006    := 'APXIMP';
                c007    := c007 || 'WRIN Base is missing!';
              END IF;
    
              IF c004 IS NULL THEN
                c006    := 'APXIMP';
                c007    := c007 || 'WRIN Suffix is missing!';
              END IF;
    
              IF c005 IS NULL THEN
                c006    := 'APXIMP';
                c007    := c007 || 'Order Qty. is missing!';
              END IF;
    
              IF c005 IS NOT NULL THEN
                IF SIGN(vt_record(5))=-1 THEN
                  c006    := 'APXIMP';
                  c007    := c007 || 'Order Qty. must be a positive integer value!';
                END IF;
                IF MOD(c005,FLOOR(c005)) <> 0 THEN
                  c006    := 'APXIMP';
                  c007    := c007 || 'Order Qty. must be a positive integer value!';
                END IF;
              END IF;
            EXCEPTION
              WHEN others THEN
                c006    := 'APXIMP';
                c007    := c007 || 'Order Qty. must be a positive integer value!';
    I am new to the collections, so if someone could show me an example or point me in the right direction, as there seems to be several types of update of collection procedures.

    See you soon

    Gus

    Hello

    You talk about the package but written the anonymous block syntax. I did understand what you're trying to do.

    Assuming that it is a procedure of your code should look like

    CREATE OR REPLACE PROCEDURE UPDATE_COLL (
      P_collection_name IN VARCHAR2  -- parameter passed when calling from Apex Process
    ) AS
    
    begin
    
    for x in (select seq_id, c001, c002, c003, c004, c005, c006, c007
             from apex_collections
            where collection_name = p_ collection_name )
    LOOP
    
         IF x.c001 IS NULL THEN
          apex_collection.update_member_attribute (
             p_collection_name=> p_collection_name,
             p_seq=> x.seq_id,
             p_attr_number =>6,
             p_attr_value=> 'APXIMP'
            );
           apex_collection.update_member_attribute (
              p_collection_name=> p_collection_name,
              p_seq=> x.seq_id,
             p_attr_number =>7,
             p_attr_value=> x.c007 || 'Storekey is missing!'
          );
         END IF;
    
        IF x.c002 IS NULL THEN
          apex_collection.update_member_attribute (
             p_collection_name=> p_collection_name,
             p_seq=> x.seq_id,
             p_attr_number =>6,
             p_attr_value=> 'APXIMP'
            );
           apex_collection.update_member_attribute (
              p_collection_name=> p_collection_name,
              p_seq=> x.seq_id,
             p_attr_number =>7,
             p_attr_value=> x.c007 ||  'Plan Delivery Moment is missing!'
          );
         END IF;
    
        IF x.c003 IS NULL THEN
          apex_collection.update_member_attribute (
             p_collection_name=> p_collection_name,
             p_seq=> x.seq_id,
             p_attr_number =>6,
             p_attr_value=> 'APXIMP'
            );
           apex_collection.update_member_attribute (
              p_collection_name=> p_collection_name,
              p_seq=> x.seq_id,
             p_attr_number =>7,
             p_attr_value=> x.c007 ||   'WRIN Base is missing!'
          );
        END IF;
    
        IF x.c004 IS NULL THEN
          apex_collection.update_member_attribute (
             p_collection_name=> p_collection_name,
             p_seq=> x.seq_id,
             p_attr_number =>6,
             p_attr_value=> 'APXIMP'
            );
           apex_collection.update_member_attribute (
              p_collection_name=> p_collection_name,
              p_seq=> x.seq_id,
             p_attr_number =>7,
             p_attr_value=> x.c007 ||  'WRIN Suffix is missing!'
          );
       END IF;
    
      IF x.c005 IS NULL THEN
          apex_collection.update_member_attribute (
             p_collection_name=> p_collection_name,
             p_seq=> x.seq_id,
             p_attr_number =>6,
             p_attr_value=> 'APXIMP'
            );
          apex_collection.update_member_attribute (
              p_collection_name=> p_collection_name,
              p_seq=> x.seq_id,
             p_attr_number =>7,
             p_attr_value=> x.c007 || 'Order Qty. is missing!'
          );
      END IF;
    
      IF x.c005 IS NOT NULL THEN
          IF SIGN(c005)=-1 THEN
          apex_collection.update_member_attribute (
             p_collection_name=> p_collection_name,
             p_seq=> x.seq_id,
             p_attr_number =>6,
             p_attr_value=> 'APXIMP'
            );
          apex_collection.update_member_attribute (
              p_collection_name=> p_collection_name,
              p_seq=> x.seq_id,
             p_attr_number =>7,
             p_attr_value=> x.c007 || 'Order Qty. must be a positive integer value!'
          );
         END IF;
         IF MOD(c005,FLOOR(c005))  0 THEN
          apex_collection.update_member_attribute (
             p_collection_name=> p_collection_name,
             p_seq=> x.seq_id,
             p_attr_number =>6,
             p_attr_value=> 'APXIMP'
            );
          apex_collection.update_member_attribute (
              p_collection_name=> p_collection_name,
              p_seq=> x.seq_id,
             p_attr_number =>7,
             p_attr_value=> x.c007 ||'Order Qty. must be a positive integer value!'
          );
        END IF;
      END IF;
    END LOOP;
     EXCEPTION
              WHEN others THEN
          apex_collection.update_member_attribute (
             p_collection_name=> p_collection_name,
             p_seq=> x.seq_id,
             p_attr_number =>6,
             p_attr_value=> 'APXIMP'
            );
          apex_collection.update_member_attribute (
              p_collection_name=> p_collection_name,
              p_seq=> x.seq_id,
             p_attr_number =>7,
             p_attr_value=> x.c007 || 'Order Qty. must be a positive integer value!'
          );
    end;
    
  • How to write in the csv file - what's wrong with that?

    Hi all

    I created a view that makes all kinds of calculations, now I need to write the output in the csv file. How can I do this through a procedure? Sorry I've never had to create a csv file before and this is my first time.


    Thank you!

    Published by: user5737516 on November 18, 2009 09:47

    See:
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:1992907061984
    (points to several other links)
    and/or
    http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteflat.html

Maybe you are looking for