Create the script from another script using GUEST

Oracle 11

Instead of having to make a link to a different database, I want to create 2 scripts that are run from a shell script and run separately. Run Script1 in Database1 would create 2 Script using PROMPT to create the second script while entering a date of base1 to base2. I've almost got it but the problem is... Script2 using COPY FROM and I need to put a "-" at the end of each line that the GUEST takes as a literal instead of as part of the output.

SCRIPT1:
set pagesize 0
set trimspool on
set linesize 2000
set echo off
set verify off
set feedback off
set sqlblanklines on

spool /home/michelle/sql_scripts/sl_dtc_copy2.sql

PROMPT whenever sqlerror exit sql.sqlcode rollback
PROMPT SET ARRAYSIZE 5000
PROMPT SET COPYCOMMIT 20
PROMPT set linesize 4000
PROMPT 
PROMPT COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2}
PROMPT CREATE SL_DTC_TMP USING SELECT DISTINCT 
PROMPT col1, col2, col3
PROMPT FROM dual
PROMPT WHERE veh_data_elements_cd = 'ODO_READ'
PROMPT and       dh.data_collected_timstm >=  
select trunc(sysdate)-7 from dual; 
PROMPT and       substr(vdh.vin,10,1) in ('A','B','C','D') 
PROMPT /

PROMPT spool off
PROMPT exit

spool off
exit
SCRIPT2 NOW:
whenever sqlerror exit sql.sqlcode rollback
SET ARRAYSIZE 5000
SET COPYCOMMIT 20
set linesize 4000

COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2}
CREATE SL_DTC_TMP USING SELECT DISTINCT
col1, col2, col3
FROM dual
WHERE veh_data_elements_cd = 'ODO_READ'
and       dh.data_collected_timstm >=
12-AUG-11
and       substr(vdh.vin,10,1) in ('A','B','C','D')
/
spool off
exit
SCRIPT2 HOW IT SHOULD BE:
-A [SPACE] AND a [-] at the end of each line
-THE DATE MUST HAVE THE APOSTROPHES AND PREFERABLY AT THE END OF THE PREVIOUS LINE
whenever sqlerror exit sql.sqlcode rollback
SET ARRAYSIZE 5000
SET COPYCOMMIT 20
set linesize 4000

COPY FROM {username}/{pswd}@{DB2}  TO {username}/{pswd}@{DB2} -
CREATE SL_DTC_TMP USING SELECT DISTINCT -
col1, col2, col3 -
FROM dual -
WHERE veh_data_elements_cd = 'ODO_READ' -
and       dh.data_collected_timstm >= '12-AUG-11' -
and       substr(vdh.vin,10,1) in ('A','B','C','D')
/
spool off
exit
Thank you

Oops, sorry, I forgot to change the line.
Must be double quotes to delimit the orignial:

SELECT 'WHERE veh_data_elements_cd = ''ODO_READ'' -' from dual

Kind regards
Sylvie

Tags: Database

Similar Questions

  • I want to create new sequence from a clip using script.

    I want to create new sequence from a clip using script.

    You can pop the dialog box new sequence (which requires interaction from the user to confirm the name of sequence), or create a new sequence from a .sqpreset file (and specify the name); There is no API around the feature 'make a sequence corresponding to this project item', available in the project Panel.

  • Satellite A100-549: BSOD after I used the recovery from another PC

    Hello.

    Had a few probs with my laptop and decided to recover it using another pc recovery disc.
    I get the laptop is a Toshiba a100-549. Unfortunately for some reason I can't disks that were originally with her.

    The opertaing system is Windows xp. The disks I got with a Vista.
    It loads OK but goes to a blue screen after 30 seconds and restarts. Is there a reason for this and can I do.

    I think I may need to get your hands on a good drive and load it on again.
    Someone at - it copies of drives for this laptop and able to send me their. I'll gladly pay for them...

    Colin

    Hello

    Don t user recovery drive to another PC, because it won't work.
    You can use a clean Windows OS disk or the Toshiba recovery disc.

    Why? Because the recovery disk contains an image. The image is a package containing a Windows OS, drivers and other software.
    If you want to use the recovery from another PC disk then all the drivers, tools and software distributed for this PC will be loaded on your Toshiba laptop.
    This can cause the BSOD!

    So if you n t have the Toshiba recovery disc then you should use MS Windows CD!
    Toshiba drivers can be downloaded from the Toshiba page!

  • How to create the script to compile procedure files in oracle - urgent deadline...

    How to create the script to compile procedure files in oracle.    about to go live and have much .prc pkg in a directory usr/tmp/ar... Po... human resources etc. need to create a script to compile all the files in the folder, then do not open all necessary .prc suggestions on how to do it.   Thank you Tom.

    (1) an urgent need, ASAP,... are words that do not in a forum of volunteer. We are here to help if you need it now, for free, open a SR.

    (2) oracle procedures are not files.

    (3) I think you are trying to run operating system packages, no Oracle procedure. right?

  • I have different bookmarks I want to keep on each computer, synchronization will delete the bookmarks on a single computer and replace the bookmarks from another computer in their place

    I have not yet used sync, but I sense it's going to be a problem if I do. I have different bookmarks I want to keep it on each computer. Sync will delete the bookmarks on a single computer and replace the bookmarks from another computer in their place? So I think that will erase the bookmarks on the second computer you configured to synchronize. Is there a way to merge bookmarks on every computer in the library of a bookmark that contains all bookmarks on both computers, so I'm not all bookmarks in sync?

    Just to be clear, this is something that we have commented several times in the forum, Firefox Sync adds everything that is already in the device for the account and pushes this info for the rest of the devices.

    So if you have 2 computers with data X and the other with the data from there, once you set up synchronization in both computers you will have X + Y at the same time.

    I hope that clarifies the doubts...

  • Partition question - what would be the best way to increase its space and take part of the space from another partition

    Hello, I have my 500 GB SATA broken down into 3 partitions. Vista and 2 others. The problem is the process of using Partition Magic, Vista has been given only 30 GB, now its operation with 1-2 GB of free space. I want to know what would be the best way to increase its space and take part of the space from another partition, but I don't want to have to reinstall or do I want to lose all the data like photos, browser, documents and news ect.

    -Thank you

     

    You can read more details on "How to move from one partition to the other sapce without loss of data.

  • Flash as2 cross subject to access the SWF from another server domain

    I have question cross-domain, how do I access the .swf from another swf file without using System.Security.allowDomain() in the swf file, which we are called.

    I use 2 domains and I have 2 files swf is a.com (a.swf) and another is of bcom (b.swf) I want to access the file the a.swf b.swf frames, if I use the system.Security.allowDomain() in b.swf file I can access executives. But without using this way I can access the file from another domain.

    Because I have a risk to change the file b.swf so I vant to go without changing the file b.swf is any other wey to access frames of the file the file a.swf b.swf. Please someone help me solve this problem.

    use a local executable (such as php) to load the b.swf and send it back to a.swf.  for example:

    loadSWF.php:

    <>

    $fh = fopen ("www.b.com/b.swf", "r");

    Header ("Content-type: application/x-shockwave-flash");

    fpassthru ($FH);

    ?>

    a.fla:

    var target_mc:MovieClip=this.createEmptyMovieClip("target_mc",this.getNextHighestDepth());

    target_mc.loadMovie ("loadSWF.php");

  • Invoke the task from another process definition - is this possible

    Is it possible to invoke the task from another process definition?
    PD1 has task1
    PD2 has task2
    Call PD1.task1 from PD2.task2

    If possible, then what method API should I use.
    Thank you!

    Can you give me the right answer on this post :)

    -Kevin

  • How can I go on the internet from my PC using AppleTV computer?

    How can I go on the internet from my PC using Apple TV computer?

    You need to clarify your question.

    You cannot access your computer of the ATC but you can homeshare personal media from the PC on the ATV.

    The ATV does not have an Internet browser, that you access online content via apps designed and supported by the content owner.  However, you can AirPlay since an other iDevice on the ATV, or using third party software like air parrot on non Apple safari browse i.e. mirror the display on the ATV and iPhones...

  • Time capsule will not recognize the backup from another mac

    Time machine will not recognize the backup from another mac

    Time Machine will never find "another" Mac backups unless you've been backup that 'different' Mac on the same Capsule you have there.

    So, we need more information and to try to understand what it is that you are trying to accomplish. Please assume that we know nothing about what you could have done in the past... (since we don't have).

  • My computer crashed and after the purchase of another, I used the Migration Wizard to copy all the files to the new computer.  Everything was going well until I tried to launch LR6.  It was two weeks ago and a search for many pages of the Adobe Web site. 

    My computer crashed and after the purchase of another, I used the Migration Wizard to copy all the files to the new computer.  Everything was going well until I tried to launch LR6.  It was two weeks ago and a search for many pages of the Adobe Web site.  I think I've exhausted all the remedies listed without success codes error A12E5 to questions cloud creative, Manager of Application and error 1: Configuration problems.  I'm ready to reformat my computer and try again with Time Machine.  Help would be greatly appreciated before I waste more time on this task. Any further suggestions?

    Migration of Mac with Time Machine WILL NOT WORK with the Adobe program activations due to hidden registration files

    Sign out of your account... Uninstall... to run vacuuming...

    -non-Cloud programs, to disable the service before uninstalling

    -http://helpx.adobe.com/creative-cloud/help/install-apps.html (and uninstall)

    -using the vacuuming after uninstalling and before reinstalling is often necessary

    -https://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html

    -Restart your computer... Sign in to your account... Reinstall

  • How to create the MUCOW file in xml using Adobe Muse

    How to create the file MUCOW as xml using Adobe Muse .kindly give step tutorial or PDF... WHERE DO I CREATE MUCOW? No idea for me

    Just lucky to have this info to my favorites

    MuCow Documentation

    Muse Jam Sessions_105_ConfiguringMucows

  • Export the database from another pc - problem EXP-00056

    Hi all,

    I have a pc (called PC1) with installed Oracle11gR2. I want to export the database from another pc (called PC2) which is connect with PC1 with a LAN.
    I have connected PC2 to PC1 so:
    $ ssh oracle@IP_of_PC1

    and as the user oracle, I tried export then:
    index of the_user/the_pass exp = y subsidies forced is y = y line is my_dump.dmp log = my_log.log

    but he said to me:
    Export: Release 11.2.0.1.0 - Production on Tue 7 Sep 14:44:13 2010

    Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
    EXP-00056: ORACLE error 1034
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Linux-x86_64 error: 2: no such file or directory
    EXP-00005: all authorized logon attempts failed
    EXP-00000: export completed unsuccessfully

    Why it does not work?

    Thank you much in advance.

    Run this and show me where exactly you run

    index italia/italia@dbSID exp = y subsidies forced is y = y line is dump070910italia.dmp

  • Create the Script to add a file in an Action name


    I have a picture, and I have a practical action that records, it cultures, he saves, cultures it differently and recorded once more. Currently, I have two options for these stops - I can save each crop in a separate folder and batch rename, or I have the break from the action he saves so I can customize the file name. What I would do is create a script (or, if there is an easier way), add this file name if it will save all simply in the same folder that I have to do it manually.

    Basically, I start with the name of the file: 'TEST '.

    for the first part, it I save as 'TEST '.

    for the second record, I want to save it as "TEST_P1".

    for the third record, I want to save it as "TEST_P2".

    I am brand new to scripting, and is my programming experience with Java and medium in my past, everything feels a little familiar. If someone could help me with this, I would really appreciate it!

    Another option is to use the Image Processor Pro script. You must create several actions to different cultures, you want to make to the original document size not a crop of harvest of a crop until the final harvest.  Don't have any records in these actions. Then just use meny file > Automate > Image Processor Pro.  Implement its dialog box to save the file names you want where you want to save them create.  You can also save that in action. The image pro script processor is a Photoshop plug-in.  In the dialog box, it will record the setting you used in the action stage.    Alternatively, you can save the configuration dialog for later use in the IPP dialog before running the process put in place.

    You can store as many files as you need with IPP and run your actions simple cultures for each size of harvest. IPP opens you simply file a copy to each of your operations and after the action is performed to save the modified copy of doctment under the name of file you set up. You can configure as many tabs as you want you can even have you resized using IPP option re-size crops.   If the script is easy to use his 10 + lines of script Photoshop...

  • CDROM image attach and VM turn the Script using Onyx

    Created a CDROM image attach and VM turn on the Script from ONYX. It seems to not work. No error output of VMware PowerCli is said TI task completed

    Type                                                             Value

    -


    Task                                                             task-176

    Task                                                             task-177

    Works perfectly for me.

    How are you connected to the vCenter when you run the script?

    Always through Onyx?

    How have you checked if it works? Have you removed the ISO connection before running the script?

    It could be a problem with the changeVersion property in VirtualMachineConfigSpec object.

    Try to remove this line in the script.

    ____________

    Blog: LucD notes

    Twitter: lucd22

Maybe you are looking for